EggDuino icon indicating copy to clipboard operation
EggDuino copied to clipboard

Reverse Servo (Pen UP/Down)

Open druckgott opened this issue 6 years ago • 1 comments

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

}

druckgott avatar Apr 06 '18 18:04 druckgott

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

Tschaske avatar Nov 16 '18 17:11 Tschaske