diff options
Diffstat (limited to 'zumo/control.cpp')
-rw-r--r-- | zumo/control.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/zumo/control.cpp b/zumo/control.cpp index 263c145..778969a 100644 --- a/zumo/control.cpp +++ b/zumo/control.cpp @@ -3,6 +3,7 @@ #include <Wire.h> #include "protocol.h" +#include "control.h" #define DUI_SPEED_MOD 96.0f #define DUI_MOTOR_DIFF 0.6f @@ -11,6 +12,12 @@ void apply_state(dui_state_t *state) { float motor_l = 0.5f * state->speed * (+1.f * state->steer * DUI_MOTOR_DIFF - DUI_MOTOR_DIFF + 2) * state->speed_mod * DUI_SPEED_MOD; float motor_r = 0.5f * state->speed * (-1.f * state->steer * DUI_MOTOR_DIFF - DUI_MOTOR_DIFF + 2) * state->speed_mod * DUI_SPEED_MOD; + Serial.print(motor_l); + Serial.print(" "); + Serial.print(motor_r); + + Serial.println(""); + Zumo32U4Motors::setLeftSpeed((int16_t) motor_l); Zumo32U4Motors::setRightSpeed((int16_t) motor_r); @@ -22,7 +29,7 @@ inline bool rx() { return !digitalRead(DUI_PINOUT_NICLA_RX); } unsigned char uart_read() { if (rx() == true) return 0x00; // return immediately if line is idle - delayMicroseconds(1500); // wait out start bit + delayMicroseconds(1200); // wait out start bit unsigned char byte = 0x00; for (unsigned int i = 0; i < 8; i++) { @@ -34,4 +41,3 @@ unsigned char uart_read() { return byte; } - |