i have two nrf24l01's but cant make them work together. im trying to make the values from my seriell plotter make my motors spin on the other arduino. if you have any suggestions pleace comment or contact me on olavsie@hotmail.com underneath you can see my transmitter and reciever code:
transmitter:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
int value = 0;
const byte addresses[][6] = {"00001"};
void setup()
{
radio.begin();
radio.openWritingPipe(addresses[1]);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop()
{
delay(5);
value = Serial.parseInt();
radio.write(&value, sizeof(value));
delay(5);
}
reciever:
#include <Servo.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>
RF24 radio(7, 8); // CNS, CE
Servo ESC1, ESC2, ESC3;
const byte addresses[6] = {"00001"};
boolean value = 0;
void setup()
{
radio.begin();
radio.openReadingPipe(1, addresses[1]);
radio.startListening();
ESC1.attach(3, 700, 2000);
ESC2.attach(4, 700, 2000);
ESC3.attach(5, 700, 2000);
Serial.begin(9600);
radio.startListening();
}
void loop()
{
delay(5);
if ( radio.available())
{
while (radio.available())
{
radio.read(&value, sizeof(value));
ESC1.writeMicroseconds(value);
ESC2.writeMicroseconds(value);
ESC3.writeMicroseconds(value);
}
}
}