Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 12th, 2012  |  syntax: C  |  size: 0.73 KB  |  views: 136  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <Wire.h>
  2. #include <ArduinoNunchuk.h>
  3.  
  4. ArduinoNunchuk nunchuk = ArduinoNunchuk();
  5.  
  6. void setup()
  7. {
  8.   Serial.begin(19200);
  9.   nunchuk.init();
  10.   pinMode(13, OUTPUT);    
  11. }
  12.  
  13. void loop()
  14. {
  15.   nunchuk.update();
  16.  
  17.   if(nunchuk.accelX > 530) {
  18.     digitalWrite(13, HIGH);
  19.   } else {
  20.     digitalWrite(13, LOW);
  21.   }
  22.  
  23.   Serial.print(nunchuk.analogX, DEC);
  24.   Serial.print(' ');
  25.   Serial.print(nunchuk.analogY, DEC);
  26.   Serial.print(' ');
  27.   Serial.print(nunchuk.accelX, DEC);
  28.   Serial.print(' ');
  29.   Serial.print(nunchuk.accelY, DEC);
  30.   Serial.print(' ');
  31.   Serial.print(nunchuk.accelZ, DEC);
  32.   Serial.print(' ');
  33.   Serial.print(nunchuk.zButton, DEC);
  34.   Serial.print(' ');
  35.   Serial.println(nunchuk.cButton, DEC);
  36. }