Hi,
I want my servo to move using discrete outputs, so using arduino, I write a void loop that does
“#0L”
“#0H”
and this makes the servo move as I am pushing a botton.
I want it to go in the opposite direction, but
“#0H”
“#0L”
is not doing the trick.
Any idea on how I can accomplish this?
Viv
You will need to provide more about your code if you want us to be able to provide any meaningful help. So far, it seems that you might have a mistake on you code but we cannot tell what it is.
I’m not sure what in the code might be wrong but here is the code that I’ve been using. The servo moves “forward” in both cases. I am using arduino uno.
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
// Grip in
if (incomingByte == controls[0]) {
gripIn();
}
// Grip Out
if (incomingByte == controls[1]) {
gripOut();
}
delay(100);
}
}
void gripIn(){
Serial.println("#0L");
Serial.println("#0H");
}
void gripOut(){
Serial.println("#0H");
Serial.println("#0L");
}
just looking at your code I’d suspect the only reason your servo moves is that it is not getting an appropriate control signal. looks like you are just bit-banging the servo.
I’m following the manual for the controller. How else would I be able to do what I want?
Viv
If you are referring to the ssc-32 manual, it says to send the ssc-32 commands in the form of characters that represent various parts of the ssc-32 command set. Not sure you understand how a servo works. If you are using an arduino, you can send the ssc-32 servo commands from the serial monitor to the arduino, and the arduino sends the commands to the ssc-32 using simple test code like below.
// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later
String readString;
void setup() {
Serial.begin(9600);
Serial.println("serial test 0021"); // so I can keep track of what is loaded
}
void loop() {
while (Serial.available()) {
delay(2); //delay to allow byte to arrive in input buffer
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
readString="";
}
}