EggDuino
EggDuino copied to clipboard
Reverse Servo (Pen UP/Down)
I had the Problem hat I want to reverse the servo.
So I change the code in setPen --> Change Case0 to Case 1 und Case 1 to Case 0
void setPen(){ int cmd; int value; char *arg;
moveToDestination();
arg = SCmd.next();
if (arg != NULL) {
cmd = atoi(arg);
switch (cmd) {
case 1:
penServo.write(penUpPos);
penState=penUpPos;
break;
case 0:
penServo.write(penDownPos);
penState=penDownPos;
break;
default:
sendError();
}
}
char *val;
val = SCmd.next();
if (val != NULL) {
value = atoi(val);
sendAck();
delay(value);
}
if (val==NULL && arg !=NULL) {
sendAck();
delay(500);
}
// Serial.println("delay");
if (val==NULL && arg ==NULL)
sendError();
}
This is the right setting. 0 = down 1 = up see http://evil-mad.github.io/EggBot/ebb.html#QP