|
@ -13,7 +13,7 @@ RF24 radio(A0, 3); // CE, CSN |
|
|
|
|
|
|
|
|
byte commands[32]; //byte 0 = command
|
|
|
byte commands[32]; //byte 0 = command
|
|
|
long timer; |
|
|
long timer; |
|
|
int temperature; |
|
|
|
|
|
|
|
|
int16_t temperature; |
|
|
int distance = 0; |
|
|
int distance = 0; |
|
|
|
|
|
|
|
|
void inline clearCommands() { |
|
|
void inline clearCommands() { |
|
@ -78,7 +78,7 @@ void setup() { |
|
|
|
|
|
|
|
|
//Temperatur- und Abstandsmessung
|
|
|
//Temperatur- und Abstandsmessung
|
|
|
tempDistSetup(); |
|
|
tempDistSetup(); |
|
|
setEchoPins(0, 0); //Setze die pins für den Abstandsensor aus denen gelesenw erden soll das erster ist der Trigger-, das zweite der Echopin
|
|
|
|
|
|
|
|
|
setEchoPins(16, 5); //16: A2, 5: D5
|
|
|
timer = millis(); |
|
|
timer = millis(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -150,9 +150,8 @@ void commandInterpretation() { |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case getTemp : { |
|
|
case getTemp : { |
|
|
int temp5; |
|
|
|
|
|
temp5 = (0xFF00 & (commands[i+1] << 8)); |
|
|
|
|
|
temp5 |= (0x00FF & commands[i+2]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
radio.write(&temperature, sizeof(temperature)); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
case timeToDrive : { |
|
|
case timeToDrive : { |
|
@ -169,6 +168,7 @@ void commandInterpretation() { |
|
|
forwardA = true; |
|
|
forwardA = true; |
|
|
forwardB = true; |
|
|
forwardB = true; |
|
|
driveOn = false; */ |
|
|
driveOn = false; */ |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|