|
|
|
|
@ -92,6 +92,7 @@ int motor_test_direction = 1;
|
|
|
|
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire);
|
|
|
|
|
// Connect to a Nunchuk
|
|
|
|
|
Nunchuk nchuk;
|
|
|
|
|
HardwareSerial Serial1(PA_10, PA_9);
|
|
|
|
|
|
|
|
|
|
// ########################## SETUP ##########################
|
|
|
|
|
void setup()
|
|
|
|
|
@ -103,14 +104,16 @@ void setup()
|
|
|
|
|
// Clear the buffer
|
|
|
|
|
display.clearDisplay();
|
|
|
|
|
display.display();
|
|
|
|
|
|
|
|
|
|
display.setTextSize(1); // Draw 1X-scale text
|
|
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
|
display.setCursor(int
|
|
|
|
|
((display.width() -
|
|
|
|
|
(strlen("Hoverboard Serial") * 6)) / 2), 0);
|
|
|
|
|
display.println("Hoverboard Serial");
|
|
|
|
|
display.setCursor(52, 8);
|
|
|
|
|
display.println("v0.2");
|
|
|
|
|
display.setCursor(int
|
|
|
|
|
((display.width() -(strlen("v STM32 0.1") *6))/2), 8);
|
|
|
|
|
display.println("v STM32 0.1");
|
|
|
|
|
/*
|
|
|
|
|
display.print("Nunchuk ");
|
|
|
|
|
nchuk.connect()? display.print("") : display.print("not ");
|
|
|
|
|
@ -125,7 +128,7 @@ void setup()
|
|
|
|
|
|
|
|
|
|
Serial.begin(SERIAL_BAUD);
|
|
|
|
|
if (Serial) {
|
|
|
|
|
Serial.println("Hoverboard Serial v1.0");
|
|
|
|
|
Serial.println("Hoverboard Serial v STM32 0.1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -253,6 +256,7 @@ int old_cursorX, old_cursorY;
|
|
|
|
|
display.print(cmd2);
|
|
|
|
|
|
|
|
|
|
display.display();
|
|
|
|
|
*/
|
|
|
|
|
Send(cmd1, cmd2);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -357,18 +361,6 @@ void loop(void)
|
|
|
|
|
iTimeSend = timeNow + TIME_SEND;
|
|
|
|
|
Send(0, cmd2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display.setCursor(0, 30);
|
|
|
|
|
display.setTextSize(1); // Draw 1X-scale text
|
|
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
|
display.print("Speed : ");
|
|
|
|
|
old_cursorX = display.getCursorX();
|
|
|
|
|
old_cursorY = display.getCursorY();
|
|
|
|
|
display.fillRect(old_cursorX, old_cursorY, (6 * 5), 8, SSD1306_BLACK); // erase previous display
|
|
|
|
|
display.setCursor(old_cursorX, old_cursorY);
|
|
|
|
|
display.print(cmd2);
|
|
|
|
|
display.display();
|
|
|
|
|
|
|
|
|
|
// Calculate test command signal
|
|
|
|
|
|
|
|
|
|
if (motor_test_direction == 1) cmd2 += 1;
|
|
|
|
|
|