I have this code:
//https://www.youtube.com/watch?v=D40cgHyBLL4
#include <SPI.h>
#include "RF24.h"
RF24 myRadio (7, 8);
struct package
{
int id;
float temperature;
char text[100];
} data = {1, 0.0, ""};
byte addresses[][6] = {"0"};
const byte tonePin = 3;
void setup()
{
Serial.begin(115200);
delay(1000);
pinMode(tonePin, OUTPUT);
myRadio.begin();
myRadio.setChannel(115);
myRadio.setPALevel(RF24_PA_MAX);
myRadio.setDataRate( RF24_250KBPS ) ;
myRadio.openReadingPipe(1, addresses[0]);
myRadio.startListening();
}
void loop()
{
if ( myRadio.available())
{
int previousID = data.id;
myRadio.read( &data, sizeof(data) );
if (data.id != previousID + 1)
{
Serial.println("\t\t\t\t\tlost data");
digitalWrite(tonePin, HIGH);
delay(200);
digitalWrite(tonePin, LOW);
}
Serial.print(data.temperature);
Serial.print("\t");
Serial.println(data.text);
digitalWrite(tonePin, HIGH);
delay(50);
digitalWrite(tonePin, LOW);
}
}
The compiler returns
:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.ino.cpp.o (symbol from plugin): In function `myRadio':
(.text+0x0): multiple definition of `myRadio'
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.cpp.o (symbol from plugin):(.text+0x0): first defined here
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.ino.cpp.o (symbol from plugin): In function `myRadio':
(.text+0x0): multiple definition of `data'
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.cpp.o (symbol from plugin):(.text+0x0): first defined here
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.ino.cpp.o (symbol from plugin): In function `myRadio':
(.text+0x0): multiple definition of `loop'
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.cpp.o (symbol from plugin):(.text+0x0): first defined here
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.ino.cpp.o (symbol from plugin): In function `myRadio':
(.text+0x0): multiple definition of `setup'
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.cpp.o (symbol from plugin):(.text+0x0): first defined here
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.ino.cpp.o (symbol from plugin): In function `myRadio':
(.text+0x0): multiple definition of `addresses'
C:\Users\Rick\AppData\Local\Temp\arduino_build_213779\sketch\myRadioRx.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Where are these multiple definitions and multiple addresses?