Commit 16315208 authored by Elias's avatar Elias
Browse files

Arm Hinzugefügt

parent 8da6299f
#include <BOB3.h>
const int ID_JAKBOB =20;
const int ID_BOB = 16;
int message;
int Arm1;
int Arm2;
// Setup Funktion wie im vorigen Kapitel...
void setup() {
int id = bob3.getID();
if (id==ID_JAKBOB) {
bob3.setEyes(OFF, OFF);
}
if (id==ID_BOB) {
bob3.setEyes(OFF, OFF);
}
}
// Das soll Jakbob machen:
void loop_jakbob() {
Arm1 = bob3.getArm(1);
if (Arm1 >= 0){
bob3.setEyes(BLUE, BLUE);
delay(50);
bob3.setEyes(OFF, OFF);
bob3.transmitMessage(40);
}
Arm2 = bob3.getArm(2);
if (Arm2 >= 0){
bob3.setEyes(RED, RED);
delay(50);
bob3.setEyes(OFF, OFF);
bob3.transmitMessage(30);
}
}
// Das soll Bob machen:
void loop_bob() {
message = bob3.receiveMessage(100);
if (message == 40) {
bob3.setWhiteLeds(ON, OFF);
} else if (message == 30) {
bob3.setWhiteLeds(OFF, ON);
} else {
bob3.setWhiteLeds(OFF, OFF);
}
}
// Loop Funktion
void loop() {
int id = bob3.getID();
if (id==ID_JAKBOB) {
loop_jakbob();
} else if (id==ID_BOB) {
loop_bob();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment