From 3ad10a8654288f61a1138aba756fbeefd157937a Mon Sep 17 00:00:00 2001 From: Elena of Valhalla'' Grandi Date: Thu, 4 Apr 2013 18:32:16 +0200 Subject: Arduino sketch: print useful values on the LCD3310 screen. --- arduino_sketch/arcerino/arcerino.ino | 38 +++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/arduino_sketch/arcerino/arcerino.ino b/arduino_sketch/arcerino/arcerino.ino index 541f911..e07f2a8 100644 --- a/arduino_sketch/arcerino/arcerino.ino +++ b/arduino_sketch/arcerino/arcerino.ino @@ -1,12 +1,48 @@ +#define PORTC3 0 +#define PORTC2 0 + #include "U8glib.h" #include #include -U8GLIB_TLS8204_84X48 u8g(15, 16, 13, 2, 3); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8 +U8GLIB_TLS8204_84X48 u8g(15, 16, 13, 4, 5); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 4, Reset = 5 void setup() { + Serial.begin(9600); + nunchuk_init(); + u8g.setColorIndex(1); + u8g.setContrast(192); +} + +void draw() { + u8g.setFont(u8g_font_5x7); + u8g.setPrintPos(0,8); + u8g.print("acc: "); + u8g.print(String(nunchuk_rollangle(),DEC)); + u8g.print(";"); + u8g.print(String(nunchuk_pitchangle(),DEC)); + u8g.setPrintPos(0,16); + u8g.print("joy: "); + u8g.print(String(nunchuk_cjoy_x(),DEC)); + u8g.print(";"); + u8g.print(String(nunchuk_cjoy_y(),DEC)); + u8g.setPrintPos(0,24); + u8g.print("but: "); + u8g.print(String(nunchuk_zbutton(),DEC)); + u8g.print(";"); + u8g.print(String(nunchuk_cbutton(),DEC)); } void loop() { + nunchuk_get_data(); + + Serial.println(nunchuk_joy_x()); + + u8g.firstPage(); + do { + draw(); + } while(u8g.nextPage()); + + delay(100); } -- cgit v1.2.3