Hi, i'm using arduino as a servo controler, with the library servo.h > Arduino Playground - Servo
And the code of this page: (i use almost the same but simpled, without some options that i don't use)
#include <Servo.h>
Servo servo1; Servo servo2;
void setup() {
pinMode(1,OUTPUT);
servo1.attach(14);
servo1.setMaximumPulse(2200);
servo2.attach(15);
Serial.begin(19200);
Serial.print("Ready");
}
void loop() {
static int v = 0;
if ( Serial.available()) {
char ch = Serial.read();
switch(ch) {
case '0'...'9':
v = v * 10 + ch - '0';
break;
case 's':
servo1.write(v);
v = 0;
break;
case 'w':
servo2.write(v);
v = 0;
break;
case 'd':
servo2.detach();
break;
case 'a':
servo2.attach(15);
break;
}
}
Servo::refresh();
}
A ssc servo controller uses this 3 serial bytes:
Byte 1 Byte 2 Byte 3
[sync marker (255)] [servo # (0-254) [position (0-254)]
How can it be done? i'm newbie in programming, and i think that it will be usefull because there are a lot of generic software to control the mini ssc..
I'm planning to do a robot arm like Lynxmotion arm, but with my own design.. i want to sensorize it and make it independent from pc with arduino board..
Thanks