Hi,
I am playing around with an ESP32 (LOLIN C3 mini). I was able to get a super simple sketch uploaded eventually (I'm still not sure why its working, but it is lol).
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("Hello from ESP32");
delay(1000);
}
After getting that to work, I'm trying to do the tutorial that starts here https://www.youtube.com/watch?v=aM2ktMKAunw
about creating a bluetooth app that turns on LEDs.
This is where I'm having difficulty. When I verify the sketch:
// --------------------------------------------------
//
// Code for control of ESP32 through MIT inventor app (Bluetooth).
// device used for tests: ESP32-WROOM-32D
//
// App on phone has three buttons:
// Button 1: 11 for ON and 10 for OFF
// Button 2: 21 for ON and 20 for OFF
// Button 3: 31 for ON and 30 for OFF
//
// Written by mo thunderz (last update: 20.4.2021)
//
// --------------------------------------------------
// this header is needed for Bluetooth Serial -> works ONLY on ESP32
#include "BluetoothSerial.h"
// init Class:
BluetoothSerial ESP_BT;
// init PINs: assign any pin on ESP32
int led_pin_1 = 4;
int led_pin_2 = 0;
int led_pin_3 = 2; // On some ESP32 pin 2 is an internal LED, mine did not have one
// Parameters for Bluetooth interface
int incoming;
void setup() {
Serial.begin(19200);
ESP_BT.begin("ESP32_Control"); //Name of your Bluetooth interface -> will show up on your phone
pinMode (led_pin_1, OUTPUT);
pinMode (led_pin_2, OUTPUT);
pinMode (led_pin_3, OUTPUT);
}
void loop() {
// -------------------- Receive Bluetooth signal ----------------------
if (ESP_BT.available())
{
incoming = ESP_BT.read(); //Read what we receive
// separate button ID from button value -> button ID is 10, 20, 30, etc, value is 1 or 0
int button = floor(incoming / 10);
int value = incoming % 10;
switch (button) {
case 1:
Serial.print("Button 1:"); Serial.println(value);
digitalWrite(led_pin_1, value);
break;
case 2:
Serial.print("Button 2:"); Serial.println(value);
digitalWrite(led_pin_2, value);
break;
case 3:
Serial.print("Button 3:"); Serial.println(value);
digitalWrite(led_pin_3, value);
break;
}
}
}
I get this error information:
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function
.L0 ': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:715: undefined reference toesp_spp_disconnect'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function_stop_bt': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:716: undefined reference toesp_spp_deinit'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function.L0 ': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:189: undefined reference toesp_spp_write'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:153: undefined reference toesp_bt_gap_set_pin' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:650: undefined reference toesp_bt_gap_register_callback'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function_init_bt': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:658: undefined reference toesp_spp_register_callback'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:666: undefined reference toesp_spp_init' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:688: undefined reference toesp_bt_gap_set_security_param'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:693: undefined reference toesp_bt_gap_set_cod' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function.LVL458':
C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:265: undefined reference toesp_bt_gap_set_scan_mode' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in functionesp_spp_cb':
C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:271: undefined reference toesp_spp_start_srv' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:283: undefined reference toesp_spp_disconnect'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:364: undefined reference toesp_spp_connect' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:391: undefined reference toesp_spp_disconnect'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function.L0 ': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:126: undefined reference toesp_bt_gap_resolve_eir_data'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in functionget_name_from_eir': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:130: undefined reference toesp_bt_gap_resolve_eir_data'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function.L0 ': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:456: undefined reference toesp_bt_gap_cancel_discovery'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Temp\arduino-sketch-9A5ABB4C3BD61F8B59B571E01C5C1667\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in functionesp_bt_gap_cb': C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:455: undefined reference toesp_spp_start_discovery'
c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:522: undefined reference toesp_bt_gap_pin_reply' c:/users/lisac/appdata/local/arduino15/packages/esp32/tools/riscv32-esp-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:\Users\lisac\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\BluetoothSerial\src/BluetoothSerial.cpp:530: undefined reference toesp_bt_gap_ssp_confirm_reply'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
Can anyone help me figure out what is going wrong?
Thanks!
