Commit 1f4b56a4 authored by nanooq's avatar nanooq
Browse files

add bob wechselt farbe auf beruehrung

parent 9462aff0
#include <BOB3.h>
void setup();
void loop();
void loop_jakbob_transmitting();
void loop_jakbob_receiving();
void loop_bob_transmitting();
void loop_bob_receiving();
void loop_alice_transmitting();
void loop_alice_receiving();
// JAKBOB:
// senden, berühren BLUE
// empfange, ohne YELLOW
const int ID_JAKBOB =20;
// BOB:
// senden, berühren GREEN
// empfangen, ohne VIOLET
const int ID_BOB = 16;
// ALICE:
// senden, berühren CYAN
// empfangen, ohne RED
const int ID_ALICE = 23;
void setup() {
bob3.setEyes(OFF, OFF);
int id = bob3.getID();
if (id == ID_JAKBOB) {
bob3.setEyes(BLUE, BLUE);
delay(500);
}
if (id == ID_BOB) {
bob3.setEyes(GREEN, GREEN);
delay(500);
}
if (id == ID_ALICE) {
bob3.setEyes(CYAN, CYAN);
delay(500);
}
bob3.setEyes(OFF, OFF);
delay(500);
}
void loop() {
int id = bob3.getID();
int arm1 = bob3.getArm(1);
int arm2 = bob3.getArm(2);
bob3.enableArms(0);
bob3.enableArms(1);
if (id == ID_JAKBOB) {
if (arm1 > 0 || arm2 > 0 ) {
loop_jakbob_transmitting();
} else {
loop_jakbob_transmitting();
}
} else if (id == ID_BOB) {
if (arm1 > 0 || arm2 > 0 ) {
loop_bob_transmitting();
} else {
loop_bob_receiving();
}
} else if (id == ID_ALICE) {
if (arm1 > 0 || arm2 > 0 ) {
loop_alice_transmitting();
} else {
loop_alice_receiving();
}
}
}
void loop_jakbob_transmitting() {
bob3.setEyes(BLUE, BLUE);
delay(500);
bob3.setEyes(OFF, OFF);
delay(500);
}
void loop_jakbob_receiving() {
bob3.setEyes(YELLOW, YELLOW);
delay(500);
bob3.setEyes(OFF, OFF);
delay(500);
}
void loop_bob_transmitting() {
bob3.setEyes(GREEN, GREEN);
delay(500);
bob3.setEyes(OFF, OFF);
delay(500);
}
void loop_bob_receiving() {
bob3.setEyes(VIOLET, VIOLET);
delay(500);
bob3.setEyes(OFF, OFF);
delay(500);
}
void loop_alice_transmitting() {
bob3.setEyes(CYAN, CYAN);
delay(500);
bob3.setEyes(OFF, OFF);
delay(500);
}
void loop_alice_receiving() {
bob3.setEyes(RED, RED);
delay(500);
bob3.setEyes(OFF, OFF);
delay(500);
}
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