Hello all,
Arduino is something completely new for me. I have a project on my university to remotely control a car using 2 aruidno UNO-s and a nrf controlers. I can't understand how to send this code from one arduino to another. Do i have to put the same code on both arduinos or not? I have tried using GettingStarted from RF Libray, but I am stuck on part when i must send the code in radio.write(); i do not know what parametars to use.
Here is the thing that i have done soo far
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <Servo.h>
Servo myservo;
int pos = 90;
int power2 = 3;
int motor_forward = 5;
int motor_back = 6;
int t = 1;
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL;
void setup(void)
{
Serial.begin(57600);
radio.begin();
radio.openWritingPipe(pipe);
pinMode(motor_forward , OUTPUT);
pinMode(motor_back, OUTPUT);
analogWrite(power2, 160);
myservo.attach(4);
myservo.write(90);// attaches the servo on pin 9 to the servo object
}
void loop()
{
if (t==1){
digitalWrite(motor_forward, HIGH);
digitalWrite(motor_back, LOW);
delay(1000);
digitalWrite(motor_forward, LOW);
digitalWrite(motor_back, HIGH);
delay(1000);
t = 0;
}
else{
for(pos = 0; pos < 180; pos += 1)
{
myservo.write(constrain(pos,60,130));
delay(15);
}
for(pos = 180; pos>=1; pos-=1)
{
myservo.write(constrain(pos,60,130));
delay(15);
}
t = 1;
}
radio.write();
}
Ty for help