summaryrefslogtreecommitdiff
path: root/zumo/zumo.ino
blob: ed63f6ed0f551ac6a2ab05bcabf53798d412046e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <Zumo32U4.h>
#include <Arduino.h>
#include <Wire.h>

#include "protocol.h"

dui_state_t g_dui_target_state = {
	.steer = 1.0f,
	.speed = 1.0f,
	.current_sign = DUI_SIGN_NONE,
	.speed_mod =96.0,
};
dui_state_t g_dui_current_state = {
	.steer = 0,
	.speed = 0,
	.current_sign = DUI_SIGN_NONE,
	.speed_mod = 1.0,
};

void setup() {
}

void loop() {
	unsigned char cmd = 0;
	while ((cmd = uart_read()))
		handle_cmd(cmd, &g_dui_target_state);

	//TODO: PID controllers + sign handlers

	apply_state(&g_dui_target_state);
}