Simple Arduino Servo Controller App

This application can control up to six servos via Bluetooth connection
It can generate different sequences, save them and play them back.

I have to give credit to the Arduino code author…however I don’t remember his/her name



String readString;
#include <Servo.h> 
Servo servoA;
Servo servoB;
Servo servoC;
Servo servoD;
Servo servoE;
Servo servoF;
 

void setup() {
  Serial.begin(9600);

  

  servoA.attach(3);  //the pin for the servoa control
  servoB.attach(5);  //the pin for the servob control
  servoC.attach(6);  //the pin for the servoc control
  servoD.attach(9);  //the pin for the servod control 
  servoE.attach(10);  //the pin for the servoc control
  servoF.attach(11);  //the pin for the servod control
  servoA.write(90);
  servoB.write(90);
  servoC.write(90);
  servoD.write(90);
  servoE.write(90);
  servoF.write(90);
  
}

void loop() {



  if (Serial.available())  {
    char c = Serial.read();  
    if (c == ',') {
    if (readString.length() >1) {
        Serial.println(readString); 

        int n = readString.toInt();  

        // auto select appropriate value, copied from someone elses code.
        if(n >= 500)
        {
          Serial.print("writing Microseconds: ");
          Serial.println(n);
          if(readString.indexOf('A') >0) servoA.writeMicroseconds(n);
          if(readString.indexOf('B') >0) servoB.writeMicroseconds(n);
          if(readString.indexOf('C') >0) servoC.writeMicroseconds(n);
          if(readString.indexOf('D') >0) servoD.writeMicroseconds(n);
          if(readString.indexOf('E') >0) servoE.writeMicroseconds(n);
          if(readString.indexOf('F') >0) servoF.writeMicroseconds(n);
        }
        else
        {   
          Serial.print("writing Angle: ");
          Serial.println(n);
          if(readString.indexOf('A') >0) servoA.write(n);
          if(readString.indexOf('B') >0) servoB.write(n);
          if(readString.indexOf('C') >0) servoC.write(n);
          if(readString.indexOf('D') >0) servoD.write(n);
          if(readString.indexOf('E') >0) servoE.write(n);
          if(readString.indexOf('F') >0) servoF.write(n);
        }
         readString=""; 
      }
    }  
    else {     
      readString += c; 
    }
  }
}


App link
https://drive.google.com/file/d/1VARrjwedJVs80bhD5-QgY0piv3hsL5lr/view?usp=drive_link

1 Like

@magued Welcome to the RobotShop Community. The robot chosen looks very similar to Lynxmotion’s BRAT biped:

Do you have a video showing a robot using the APP?

1 Like

No it’s a generic Chinese biped