cnlohr / colorchord

Chromatic Sound to Light Conversion System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"undefined reference to InitColorChord()" even though the file is included - Attempting to use colorchord embedded on Espressif ESP32

ohnoitsalobo opened this issue · comments

Hey. I'm not a professional programmer, so it's entirely possible I'm going about this the wrong way. Please feel free to correct me.

Equipment:

  • factory-underclocked ESP32 modules (locked at 160MHz, no 240MHz option)
  • WS2812 LED strip

My goal: I would like to have an ESP32 analyze a stereo (left/right) audio stream and output colors to two separate LED strips. That's the hope, anyway. I ran a small code snippet to time how fast the analogReads are - if accurate, it can read one channel at up to 90kHz, and two at up to 45kHz, so I think it might work for stereo.

I am using Platformio to compile the code for the ESP32 controller. So far, I've managed to #include the header files from the embeddedcommon folder without any compilation errors. However, if I add a function call to InitColorChord() I get this error.

.pio\build\esp32\src\cc_esp32.ino.cpp.o:(.literal._Z5setupv+0x10): undefined reference to 'InitColorChord()'
.pio\build\esp32\src\cc_esp32.ino.cpp.o: In function 'setup()':
D:/Documents/Platformio/cc_esp32/src/cc_esp32.ino:24: undefined reference to 'InitColorChord()'

My files are attached as a zip. The main file is cc_esp32.ino.
My setup is Platformio with the arduinoespressif32 framework
colorchord_esp32_platformio.zip

Alright I think I solved it.

  1. A couple of the embeddedcommon files were still using #include <header.h> instead of #include "header.h"

  2. I renamed all the .c files to .cpp. Threw a bunch of syntax errors I was able to correct.

Now it compiles without errors and seems to find the functions. Hopefully this works out!