Advertisement
Guest User

Untitled

a guest
Feb 12th, 2012
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement