Serial communication problem !
hello,
i trying control servo motor via serial port. when sending angle, servo not go true angle. problem ?
i trying control servo motor via serial port. when sending angle, servo not go true angle. problem ?
code: [select]
#include <servo.h>
servo myservo1;
void setup()
{
myservo1.attach(9); // attaches servo on pin 9 servo object
serial.begin(9600);
serial.println("arduino serial servo control");
}
void loop()
{
int angle;
while(1){
serial.println("enter servo angle: ");
if (serial.available() > 0) { // check serial input
int angle = serial.read(); // read incoming byte:
myservo1.write(angle); // tell servo go position in variable 'pos'
serial.print("i received: ");
serial.println(angle);
}
}
}
what indeed. serial prints tell you? sending terminal program?
Arduino Forum > Using Arduino > Programming Questions > Serial communication problem !
arduino
Comments
Post a Comment