cocktailyogi / EggDuino

Arduino Firmware for Spherebot / Eggbot integration in Inkscape
MIT License
91 stars 138 forks source link

Reverse Servo (Pen UP/Down) #26

Open druckgott opened 6 years ago

druckgott commented 6 years ago

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();

}

Tschaske commented 5 years ago

This is the right setting. 0 = down 1 = up see http://evil-mad.github.io/EggBot/ebb.html#QP