ropg / heltec_esp32_lora_v3

Proper working Arduino library for the Heltec ESP32 LoRa v3 board, as well as for Wireless Stick v3 and Wireless Stick Lite v3. Uses RadioLib
MIT License
330 stars 16 forks source link

rx' was not declared in this scope #30

Closed GQster closed 3 months ago

GQster commented 3 months ago

Trying to use the LoRa_rx_tx example with platformIO and the 'regular board' but am getting this error:

src/main.cpp: In function 'void setup()':
src/main.cpp:55:23: error: 'rx' was not declared in this scope
   radio.setDio1Action(rx);
                       ^~
src/main.cpp: In function 'void loop()':
src/main.cpp:95:25: error: 'rx' was not declared in this scope
     radio.setDio1Action(rx);

My platformio.ini:

[env:heltec_wifi_kit_32_V3]
platform = espressif32
board = heltec_wifi_kit_32_V3
framework = arduino
lib_deps = ropg/Heltec_ESP32_LoRa_v3@^0.9.1

My only change to the code at this point is adding #include <Arduino.h> to the top.

I coppied the LoRa_rx_tx.ino file into the src/main.cpp in the platformIO project

ropg commented 3 months ago

In a .ino file, you can reference functions that are defined further down in the file, in a regular cpp file you cannot. Try lifting the definition of rx (all the way at the end) to before your main that calls it. Or have a declaration line at the beginning (outside of any functions) that just reads void rx();

GQster commented 3 months ago

oh duh... Didn't see the rx() at the bottom. my bad!