Hi to everybody.
I am here to ask help for my little project.
I am trying to send a structure package (that contain only a integer and a float) from an arduino due and a mega.
I am using this library (i think it is the newest one):GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
The problem is that the arduino due send the package to the Mega but only the first vale is usable (only the integer).
Example:
Arduino 2 send this values: ID=67
Temperature=8.0
Arduino Mega recive values: ID=67
Temperature=0.0;
i can't undertand the reason.
I also tryed with 2 arduino mega at the both side (sender and reciever)and it works fine!
I attach the code of the sender (Nuovo_Volo.ino)
#include <RF24.h>
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
typedef struct //prototipo pachetto contentente i dati in arrivo dal velivolo
{
int id=0;
float temperature = 0.0;
}info_pack;
info_pack out_data;
RF24 radio(7,9);
const uint64_t pipe = 0xE8E8F0F0E1LL;
LiquidCrystal_I2C lcd(0x3F,16,2);
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
radio.begin();
radio.openWritingPipe(pipe);
delay(100);
out_data.id=67;
out_data.temperature=8.0;
}
void loop() {
radio.write(&out_data,sizeof(out_data));
delay(100);
}
and the receiver (Nuovo_Terra.ino)
#include <RF24.h>
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
typedef struct //prototipo pachetto contentente i dati in arrivo dal velivolo
{
int id=0;
float temperature = 0.0;
}info_pack;
info_pack in_data;
RF24 radio(7,9);
const uint64_t pipe = 0xE8E8F0F0E1LL;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
Serial.begin(9600);
lcd.init(); // initialize the lcd
lcd.backlight();
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}
void loop() {
if (radio.available()){
radio.read(&in_data, sizeof(in_data));
Serial.println(in_data.id);
Serial.println(in_data.temperature);
delay(100);
}
}
Note: the lcd crystal is only initialized but not used
Someone know where is the problem?
Thank you