Hello, I'm having trouble getting a simple RF24 program working. During compilation I keep getting all kind of error messages about missing or wrong statements in libraries NRF24 an/on nRF24L01. I've searched and read but have not come anywhere near a solution. I have attached the (extensive) error messages and the code. Any help will be greatly appreciated.`
(I hope the code and errors are readable.
/* This version 20220710
feel free to copy (as I did many times)
questions ? contact me !
Ronald Ruijtenberg (ronald.ruytenberg@planet.nl)
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001"; //Byte of array representing the address. This is the address where we will send the data. This should be same on the receiving side.
int button_pin = 2;
boolean button_state = 0;
void setup() {
pinMode(button_pin, INPUT);
radio.begin(); //Starting the Wireless communication
radio.openWritingPipe(address); //Setting the address where we will send the data
radio.setPALevel(RF24_PA_MIN); //You can set it as minimum or maximum depending on the distance between the transmitter and receiver.
radio.stopListening(); //This sets the module as transmitter
}
void loop()
{
button_state = digitalRead(button_pin);
if (button_state == HIGH)
{
const char text[] = "Your Button State is HIGH";
radio.write(&text, sizeof(text)); //Sending the message to receiver
}
else
{
const char text[] = "Your Button State is LOW";
radio.write(&text, sizeof(text)); //Sending the message to receiver
}
radio.write(&button_state, sizeof(button_state)); //Sending the message to receiver
delay(1000);
}
Arduino:1.8.13 (Windows 10), Board:"Arduino Uno"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Gebruiker\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Gebruiker\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Hobby\Arduino I\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\GEBRUI~1\AppData\Local\Temp\arduino_build_171537 -warnings=none -build-cache C:\Users\GEBRUI~1\AppData\Local\Temp\arduino_cache_78151 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Gebruiker\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Gebruiker\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Hobby\Arduino I\libraries -fqbn=arduino:avr:uno -ide-version=10813 -build-path C:\Users\GEBRUI~1\AppData\Local\Temp\arduino_build_171537 -warnings=none -build-cache C:\Users\GEBRUI~1\AppData\Local\Temp\arduino_cache_78151 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for SPI.h: [SPI@1.0]
ResolveLibrary(SPI.h)
-> candidates: [SPI@1.0]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for nRF24L01.h: [nRF24L01 NRFLite@3.0.3]
ResolveLibrary(nRF24L01.h)
-> candidates: [nRF24L01 NRFLite@3.0.3]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src" "-IC:\\Hobby\\Arduino I\\libraries\\nRF24L01" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for RF24.h: [RF24]
ResolveLibrary(RF24.h)
-> candidates: [RF24]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src" "-IC:\\Hobby\\Arduino I\\libraries\\nRF24L01" "-IC:\\Hobby\\Arduino I\\libraries\\RF24" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src" "-IC:\\Hobby\\Arduino I\\libraries\\nRF24L01" "-IC:\\Hobby\\Arduino I\\libraries\\RF24" "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src\\SPI.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src" "-IC:\\Hobby\\Arduino I\\libraries\\nRF24L01" "-IC:\\Hobby\\Arduino I\\libraries\\RF24" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp" -o "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Sketch aan het compileren...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SPI\\src" "-IC:\\Hobby\\Arduino I\\libraries\\nRF24L01" "-IC:\\Hobby\\Arduino I\\libraries\\RF24" "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp" -o "C:\\Users\\GEBRUI~1\\AppData\\Local\\Temp\\arduino_build_171537\\sketch\\Sending_data_NRF24_20220710_1.ino.cpp.o"
In file included from C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino:9:0:
C:\Hobby\Arduino I\libraries\RF24/RF24.h:2:18: error: stray '\342' in program
Search or jump to…
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:2:19: error: stray '\200' in program
Search or jump to…
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:2:20: error: stray '\246' in program
Search or jump to…
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:8:1: error: stray '@' in program
@RonaldRuijtenberg
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:22:1: error: stray '@' in program
@2bndy5
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:23:30: error: stray '#' in program
2bndy5 Add isFifo() methods (#849)
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:24:1: error: stray '\342' in program
…
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:24:2: error: stray '\200' in program
…
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:24:3: error: stray '\246' in program
…
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:1: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:8: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:18: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:25: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:35: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:45: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:53: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:65: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:74: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:80: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:88: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:28:108: error: stray '@' in program
@TMRh20@maniacbug@2bndy5@gcopeland@Avamander@akatran@soligen2010@mz-fuzzy@komby@dstroy0@zador-blood-stained@wmarkow
^
C:\Hobby\Arduino I\libraries\RF24/RF24.h:1:1: error: 'Skip' does not name a type
Skip to content
^~~~
In file included from C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino:9:0:
C:\Hobby\Arduino I\libraries\RF24/RF24.h:98:3: error: 'rf24_pa_dbm_e' does not name a type
} rf24_pa_dbm_e;
^~~~~~~~~~~~~
In file included from C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino:9:0:
C:\Hobby\Arduino I\libraries\RF24/RF24.h:1790:28: error: 'rf24_pa_dbm_e' has not been declared
void startConstCarrier(rf24_pa_dbm_e level, uint8_t channel);
^~~~~~~~~~~~~
C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino: In function 'void setup()':
Sending_data_NRF24_20220710_1:21:20: error: 'RF24_PA_MIN' was not declared in this scope
radio.setPALevel(RF24_PA_MIN); //You can set it as minimum or maximum depending on the distance between the transmitter and receiver.
^~~~~~~~~~~
C:\Hobby\Arduino Master\NRF24\Sending_data_NRF24_20220710_1\Sending_data_NRF24_20220710_1.ino:21:20: note: suggested alternative: 'RF24_SPI_PTR'
radio.setPALevel(RF24_PA_MIN); //You can set it as minimum or maximum depending on the distance between the transmitter and receiver.
^~~~~~~~~~~
RF24_SPI_PTR
Meerdere bibliotheken gevonden voor "nRF24L01.h"
Gebruikt: C:\Hobby\Arduino I\libraries\nRF24L01
Niet gebruikt: C:\Hobby\Arduino I\libraries\NRFLite
Bibliotheek SPI op versie 1.0 in map: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI wordt gebruikt
Bibliotheek nRF24L01 in map: C:\Hobby\Arduino I\libraries\nRF24L01 (legacy) wordt gebruikt
Bibliotheek RF24 in map: C:\Hobby\Arduino I\libraries\RF24 (legacy) wordt gebruikt
exit status 1
'RF24_PA_MIN' was not declared in this scope

