Hi, i made a program to move servos whit android, it works well, but now i want to save sequences of movements, for example, move servo 1 to 180°, move servo 2 to 100°, etc. only using the android phone, i have a idea but i dont know if it is good, this is the code to do the movements in manual form:
[c
The EEPROM.write() writes only a byte.
But since a byte is 0...255 and the servo position is 0...180 it is okay.
Have you considered using a case statement ?
if (Serial.available() > 0) {
data = Serial.read();
}
switch (data) {
case 'X':
case 'x':
EEPROM.write( 1, servo1 position);
EEPROM.write( 2, servo2 position);
break;
case 'Y':
case 'y':
pos1 = EEPROM.read(1);
servo1.write(pos1);
pos2 = EEPROM.read(2);
servo1.write(pos2);
break;
default:
break;
}