Browse Source

Fixed some issues.

master
nickg 4 years ago
parent
commit
b777bca88d
  1. 9
      Code/miniRobot/miniRobot.ino
  2. 1
      Code/miniRobot/temperatureDistance.ino

9
Code/miniRobot/miniRobot.ino

@ -13,6 +13,8 @@ RF24 radio(A0, 3); // CE, CSN
byte commands[32]; //byte 0 = command byte commands[32]; //byte 0 = command
long timer; long timer;
int temperature;
int distance = 0;
void inline clearCommands() { void inline clearCommands() {
for(uint8_t i=0; i<32; i++) { for(uint8_t i=0; i<32; i++) {
@ -31,7 +33,7 @@ const byte address[6] = "00001";
#define stopDrive 6 //stop #define stopDrive 6 //stop
#define getTemp 7 //get temperature #define getTemp 7 //get temperature
#define timeToDrive 8 //Zeitdauer des fahrens #define timeToDrive 8 //Zeitdauer des fahrens
#define distance 10 //Abstand zu Objekten
#define getDistance 10 //Abstand zu Objekten
//Motortreiber //Motortreiber
//#include <MX1508.h> //#include <MX1508.h>
@ -148,8 +150,9 @@ void commandInterpretation() {
break; break;
} }
case getTemp : { case getTemp : {
temperatur = (0xFF00 & (commands[i+1] << 8));
temperatur |= (0x00FF & commands[i+2]);
int temp5;
temp5 = (0xFF00 & (commands[i+1] << 8));
temp5 |= (0x00FF & commands[i+2]);
break; break;
} }
case timeToDrive : { case timeToDrive : {

1
Code/miniRobot/temperatureDistance.ino

@ -41,7 +41,6 @@ void measureDistance(){
delayMicroseconds(10); delayMicroseconds(10);
// ... put the trigger down ... // ... put the trigger down ...
distance = 600;
PORTD &= ~(1<<trig); PORTD &= ~(1<<trig);
PCICR |= 0b00000100; PCICR |= 0b00000100;

Loading…
Cancel
Save