|
|
|
|
@ -72,13 +72,6 @@ void setup()
|
|
|
|
|
display.clearDisplay();
|
|
|
|
|
display.drawBitmap((SCREEN_WIDTH - my_splash_width) / 2, (SCREEN_HEIGHT - my_splash_height) / 2,
|
|
|
|
|
my_splash_data, my_splash_width, my_splash_height, 1);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
display.setTextSize(1); // Draw 1X-scale text
|
|
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
|
display.setCursor(int((display.width() - (strlen("g")*6))), 50);
|
|
|
|
|
display.println("g");
|
|
|
|
|
*/
|
|
|
|
|
display.display();
|
|
|
|
|
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
@ -121,20 +114,14 @@ void Nunchuk_control()
|
|
|
|
|
|
|
|
|
|
if (!nchuk.update())
|
|
|
|
|
{
|
|
|
|
|
Serial.println("Controller Disconnected!");
|
|
|
|
|
nchuk.reconnect();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
cmd1 = map(nchuk.joyX(), 0, 256, 150, -150); // x - axis. Nunchuck joystick readings range 30 - 230
|
|
|
|
|
cmd1 = map(nchuk.joyX(), 0, 256, 150, -150); // x - axis. Nunchuck joystick readings range 150 -150
|
|
|
|
|
cmd2 = map(nchuk.joyY(), 0, 256, -150, 150); // y - axis
|
|
|
|
|
/*
|
|
|
|
|
Serial.print("X : ");
|
|
|
|
|
Serial.print(nchuk.joyX());
|
|
|
|
|
Serial.print(" Y : ");
|
|
|
|
|
Serial.println(nchuk.joyY());
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Send(cmd1, cmd2);
|
|
|
|
|
}
|
|
|
|
|
display.setCursor(0, 40);
|
|
|
|
|
@ -149,7 +136,7 @@ void Nunchuk_control()
|
|
|
|
|
display.setCursor(0, 50);
|
|
|
|
|
display.setTextSize(1); // Draw 1X-scale text
|
|
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
|
display.print("y : ");
|
|
|
|
|
display.print("Y : ");
|
|
|
|
|
old_cursorX = display.getCursorX();
|
|
|
|
|
old_cursorY = display.getCursorY();
|
|
|
|
|
display.fillRect(old_cursorX, old_cursorY, (6 * 5), 8, SSD1306_BLACK); // erase previous display
|
|
|
|
|
@ -170,5 +157,5 @@ void loop()
|
|
|
|
|
// if (iTimeSend > timeNow) return;
|
|
|
|
|
iTimeSend = timeNow + TIME_SEND;
|
|
|
|
|
Nunchuk_control();
|
|
|
|
|
Serial.println(timeNow);
|
|
|
|
|
// Serial.println(timeNow);
|
|
|
|
|
}
|
|
|
|
|
|