code clean up

master
JbLb 6 years ago
parent ebb87fc624
commit 45d989464d

@ -86,10 +86,10 @@ Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// ########################## SETUP ##########################
void setup()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
// Clear the buffer
display.clearDisplay();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x64)
// Clear the buffer
display.clearDisplay();
display.display();
display.setCursor(0, 0);
display.println("Hello World!");
@ -97,12 +97,7 @@ void setup()
Serial1.begin(HOVER_SERIAL_BAUD); // RX, TX from arduino to TX RX on hoverboard board. ! be carreful 3v3
pinMode(LED_BUILTIN, OUTPUT);
pinMode (2,INPUT_PULLUP); // pin 2 to GNd to start
while (digitalRead(2))
{
/* code */
}
Serial.begin(SERIAL_BAUD);
Serial.begin(SERIAL_BAUD);
if (Serial) {
Serial.println("Hoverboard Serial v1.0");
}
@ -190,23 +185,18 @@ int iTestMax = SPEED_MAX_TEST;
int iTest = 0;
void loop(void)
{
unsigned long timeNow = millis();
// Check for new received data
Receive();
{
unsigned long timeNow = millis();
// Send commands
if (iTimeSend > timeNow) return;
iTimeSend = timeNow + TIME_SEND;
Send(0, abs(iTest));
// Check for new received data
Receive();
// Calculate test command signal
iTest += 10;
if (iTest > iTestMax) iTest = -iTestMax;
// Blink the LED
digitalWrite(LED_BUILTIN, (timeNow%2000)<1000);
// Blink the LED
digitalWrite(LED_BUILTIN, (timeNow % 2000) < 1000);
}
// ########################## END ##########################

Loading…
Cancel
Save