void setup()
{
myservo1.attach(3); // attach servo signal wire to pin 9
myservo2.attach(5);
myservo3.attach(6);
myservo4.attach(A0);
myservo5.attach(10);
myservo6.attach(11);
//Setup usb serial connection to computer
myservo1.write(90);
myservo2.write(22.5);
myservo3.write(180);
myservo4.write(90);
myservo5.write(90);
myservo6.write(45);
Serial.begin(9600);
//Setup Bluetooth serial connection to android
bluetooth.begin(9600);
}
void loop()
{
//Read from bluetooth and write to usb serial
if(bluetooth.available()>= 2 )
{
unsigned int servopos = bluetooth.read();
unsigned int servopos1 = bluetooth.read();
unsigned int realservo = (servopos1 *256) + servopos;
Serial.println(realservo);