diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2023-06-07 13:54:17 +0200 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2023-06-07 13:54:17 +0200 |
commit | e943ed3992044c601c3eb036a07ff9f68db52c8b (patch) | |
tree | a914b2d8dea7e399f42df64df82f3b5a95c523b8 /zumo/protocol.cpp | |
parent | 96b0d8f65fd7d7bd8cd2177c2e6d3f1679239519 (diff) |
zumo update
Diffstat (limited to 'zumo/protocol.cpp')
-rw-r--r-- | zumo/protocol.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/zumo/protocol.cpp b/zumo/protocol.cpp index ab8397a..d176c24 100644 --- a/zumo/protocol.cpp +++ b/zumo/protocol.cpp @@ -1,5 +1,8 @@ -#include "protocol.h" +#include <Zumo32U4.h> +#include "protocol.h" +#include <Arduino.h> +#include <Zumo32U4LCD.h> #define DUI_CMD_NULL 0x00 #define DUI_CMD_SIGN_START 0x01 #define DUI_CMD_SIGN_END 0x0f @@ -7,15 +10,22 @@ #define DUI_CMD_SPEED_END 0x1f #define DUI_CMD_STEER_START 0x20 #define DUI_CMD_STEER_END 0xff +Zumo32U4OLED display; void handle_cmd(unsigned char cmd, dui_state_t *state) { + Serial.println(cmd,HEX); + if (cmd == DUI_CMD_NULL) return; else if (DUI_CMD_SIGN_START <= cmd && cmd <= DUI_CMD_SIGN_END) { state->current_sign = (dui_e_sign) (cmd - DUI_CMD_SIGN_START); + display.clear(); + display.print(state->current_sign+1); + display.gotoXY(0, 1); } else if (DUI_CMD_SPEED_START <= cmd && cmd <= DUI_CMD_SPEED_END) { - state->speed = (float) (cmd - DUI_CMD_SPEED_START) / (float) (DUI_CMD_SPEED_END - DUI_CMD_SPEED_START); + Serial.print(" Hallo: " ); + state->Speed = (float) (cmd - DUI_CMD_SPEED_START) / (float) (DUI_CMD_SPEED_END - DUI_CMD_SPEED_START); + Serial.println(state->Speed); } else if (DUI_CMD_STEER_START <= cmd && cmd <= DUI_CMD_STEER_END) { state->steer = (float) (cmd - DUI_CMD_STEER_START) / (float) (DUI_CMD_STEER_END - DUI_CMD_STEER_START) * (float) 2 - (float) 1; } } - |