aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena of Valhalla'' Grandi <valhalla.trueelena.org>2013-04-04 18:32:16 +0200
committerElena of Valhalla'' Grandi <valhalla.trueelena.org>2013-04-05 20:02:29 +0200
commit3ad10a8654288f61a1138aba756fbeefd157937a (patch)
treeb6fc71dad1e845505730b81378aa0ee8db038cd7
parent65067712bb2f57270c3c9ff1ca85dcd76395f3d3 (diff)
Arduino sketch: print useful values on the LCD3310 screen.
-rw-r--r--arduino_sketch/arcerino/arcerino.ino38
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);
}