From 7f77bde5c68a4e6f11ff396a3b0ae046f5d4a4f8 Mon Sep 17 00:00:00 2001 From: Yves Ehrlich Date: Thu, 13 Feb 2020 09:10:20 +0100 Subject: [PATCH] Code bereinigt --- Code/miniRobot/miniRobot.ino | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Code/miniRobot/miniRobot.ino b/Code/miniRobot/miniRobot.ino index f87e226..b328b40 100644 --- a/Code/miniRobot/miniRobot.ino +++ b/Code/miniRobot/miniRobot.ino @@ -37,21 +37,9 @@ const byte address2[6] = "00002"; #define getDistance 10 //Abstand zu Objekten //Motortreiber -//#include #include -#define BEEP 14 -/* -#define PWM_PINA 10 -#define PINA 8 -#define PWM_PINB 9 -#define PINB 7 -#define NUMPWM 1 - -#define RESOLUTION 255 */ - -//MX1508 motorA(PWM_PINA,PINA, FAST_DECAY, NUMPWM); -//MX1508 motorB(PWM_PINB,PINB, FAST_DECAY, NUMPWM); +#define BEEP 14 //Motoren drehen bei diesem PWM Wert nicht, aber fiepen L298N drive; @@ -61,8 +49,8 @@ bool forwardA = true; bool forwardB = true; volatile bool driveOn = false; -volatile long driveTimeout = 0; -volatile long driveTimeDiff = 0; +volatile uint32_t driveTimeout = 0; +volatile uint32_t driveTimeDiff = 0; volatile bool startNewMeasurement = true; @@ -106,7 +94,7 @@ void loop() { // Serial.println("berechnen"); distance = calculateDistance(); } - +//wurden Kommandos empfangen? if (radio.available()) { radio.read(&commands, sizeof(commands)); commandInterpretation(); @@ -182,7 +170,7 @@ void commandInterpretation() { uint16_t driveTime = 0; driveTime = (0xFF00 & (commands[i+1] << 8)); driveTime |= (0x00FF & commands[i+2]); - driveTimeout = (long)driveTime; + driveTimeout = (uint32_t)driveTime; driveTimeDiff = millis(); //Serial.println(driveTimeout); break;