Getting these errors:
D:\1. Documents\Arduino\NRF_tx\NRD_rx.ino:14:11: error: redefinition of 'RF24 radio'
RF24 radio(7, 8); // CE, CSN
^
D:\1. Documents\Arduino\NRF_tx\NRF_tx.ino:14:6: note: 'RF24 radio' previously declared here
RF24 radio(7, 8); // CE, CSN
^~~~~
D:\1. Documents\Arduino\NRF_tx\NRD_rx.ino:16:21: error: redefinition of 'const byte address [6]'
const byte address[6] = "00001";
^
D:\1. Documents\Arduino\NRF_tx\NRF_tx.ino:16:12: note: 'const byte address [6]' previously defined here
const byte address[6] = "00001";
^~~~~~~
D:\1. Documents\Arduino\NRF_tx\NRD_rx.ino: In function 'void setup()':
D:\1. Documents\Arduino\NRF_tx\NRD_rx.ino:18:6: error: redefinition of 'void setup()'
void setup()
^~~~~
D:\1. Documents\Arduino\NRF_tx\NRF_tx.ino:18:6: note: 'void setup()' previously defined here
void setup()
^~~~~
D:\1. Documents\Arduino\NRF_tx\NRD_rx.ino: In function 'void loop()':
D:\1. Documents\Arduino\NRF_tx\NRD_rx.ino:27:6: error: redefinition of 'void loop()'
void loop()
^~~~
D:\1. Documents\Arduino\NRF_tx\NRF_tx.ino:26:6: note: 'void loop()' previously defined here
void loop()
^~~~
exit status 1
Compilation error: redefinition of 'RF24 radio'
I downloaded the official library from link below as zip and imported it in the official project.
I am using the newest IDE 2.0.3 for arduino.
Here is the code:
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Receiver Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop()
{
if (radio.available())
{
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
}