Pages: [1]   Go Down
Author Topic: Save Servo Position on EEPROM  (Read 679 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
« Last Edit: March 23, 2013, 04:38:19 pm by Eduort » Logged

Offline Offline
Edison Member
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 =;

switch (data) {
case 'X':
case 'x':
  EEPROM.write( 1, servo1 position);
  EEPROM.write( 2, servo2 position);         
case 'Y':
case 'y':
  pos1 =;
  pos2 =;

Pages: [1]   Go Up
Jump to: