hi, am quite new here .
I am making the remote control of an allready bought RC car using 2 xbee and 2 arduino uno 1 petentiometre and 1 joystick(to set up the 0 and control speed)and 1 petentiometre and 1 joystick (to set up the 0 and control direction )
for now i manged to recieve 2 values (speed and direction ) from the emitter to the receiver (both unos on software serial didnt use xbee yet ) but the when trying to use servo.write(direction ) the motor glitch . any idea why ?
this is the receiver programme
#include <SoftwareSerial.h>
#include <Servo.h>
int i =0;
Servo myServo;
Servo dc;
SoftwareSerial mySerial(4, 5); // RX, TX
int direct=0 , velocity =0 ;
void setup()
{
Serial.begin(9600);
myServo.attach(9);
dc.attach(10);
mySerial.begin(4800);
}
void loop() // run over and over
{
while (mySerial.available()==0);
direct = mySerial.parseInt();
velocity=mySerial.parseInt();
Serial.print(" D: ");
Serial.print(direct);
Serial.print(" V: ");
Serial.println(velocity);
// if(mySerial.read()=='\n')
// {
// i++;
// Serial.println(i);
myServo.write(direct);
delay(150);
dc.write(velocity);
// }
// mySerial.flush();
}