diff options
-rw-r--r-- | arduino_sketch/arcerino/arcerino.ino | 38 |
1 files changed, 37 insertions, 1 deletions
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 <Wire.h> #include <wiinunchuck.h> -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); } |