Commit 00e12216 authored by nanooq's avatar nanooq
Browse files

refactor

parent 16315208
#include <BOB3.h>
void setup();
void loop_jakbob();
void loop();
void loop_bob();
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();
bob3.enableArms(1);
int id = bob3.getID() ;
if (id==ID_JAKBOB) {
bob3.setEyes(OFF, OFF);
}
......@@ -16,7 +21,27 @@ void setup() {
bob3.setEyes(OFF, OFF);
}
}
// Das soll Jakbob machen:
void loop() {
int id = bob3.getID();
if (id == ID_JAKBOB) {
loop_jakbob();
} else if (id == ID_BOB) {
loop_bob();
}
}
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);
}
}
void loop_jakbob() {
Arm1 = bob3.getArm(1);
if (Arm1 >= 0){
......@@ -33,29 +58,5 @@ void loop_jakbob() {
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