Small edits

This commit is contained in:
Jared Dunbar 2023-04-03 20:18:45 -04:00
parent 80f7eb25bf
commit 13a9539efe
1 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,7 @@ void initWiFi() {
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
Serial.println("Begin!");
initWiFi(); initWiFi();
motor.init(); motor.init();
} }
@ -64,11 +65,14 @@ void get_control_inputs(float &throttle, int8_t &direction) {
if (httpResponseCode == 200) { if (httpResponseCode == 200) {
String payload = http.getString(); String payload = http.getString();
parse_json(payload, throttle, direction); parse_json(payload, throttle, direction);
Serial.println("200");
} else { } else {
Serial.println("Error communicating with webserver. Got HTTP status code:"); Serial.println("Error communicating with webserver. Got HTTP status code:");
Serial.println(httpResponseCode); Serial.println(httpResponseCode);
} }
http.end(); http.end();
} else {
Serial.println("WiFi not connected!");
} }
} }
@ -76,5 +80,5 @@ void loop() {
get_control_inputs(throttle, direction); get_control_inputs(throttle, direction);
inertia(throttle, direction, motor_throttle, motor_direction); inertia(throttle, direction, motor_throttle, motor_direction);
motor.move(motor_direction, (uint8_t) (motor_throttle * 127.0)); motor.move(motor_direction, (uint8_t) (motor_throttle * 127.0));
delay(1); delay(25);
} }