I am working on a car and transmitter that wirelessly communicate with 2 nrf24l01 with antene, it is quite good but sometimes an error value is passed (every 8 times or so). I have seen this on the serial monitor, if nothing is done with the joystick the number remains 0 and then every 8 times suddenly a 127, which leads to a short sudden movement. I could write a piece of code that he filters it out but maybe it's better if I get a more stable conection. anyone have an idea? everything is welcome!
*** receiver ***
void receiveData() {
if (radio.available()) {
radio.read(&receivedData, sizeof(receivedData));
pot_L_VAL = atoi(&receivedData[0]);
delay(5);
radio.read(&receivedData, sizeof(receivedData));
pot_R_VAL = atoi(&receivedData[0]);
delay(5);
radio.read(&receivedData, sizeof(receivedData));
xAxis_L_VAL = atoi(&receivedData[0]);
delay(5);
radio.read(&receivedData, sizeof(receivedData));
xAxis_R_VAL = atoi(&receivedData[0]);
delay(5);
}
}
*** transmitter***
void send_Package() {
Read_Controller();
pot_L_VAL.toCharArray(xyData, 5);
radio.write(&xyData, sizeof(xyData));
pot_R_VAL.toCharArray(xyData, 5);
radio.write(&xyData, sizeof(xyData));
xAxis_L_VAL.toCharArray(xyData, 5);
radio.write(&xyData, sizeof(xyData));
xAxis_R_VAL.toCharArray(xyData, 5);
radio.write(&xyData, sizeof(xyData));
delay(20);
}
(I use a lot of tabs so if you want to see the full code you have to download the zip file, sorry)
and the _PCM3 files are the files for the reveiver, the _PCT files are for the transmitter...
Isaak
code.zip (3.86 KB)