Anhang D 

Listings

D.1Wii-Nunchuk-Funktionsbibliothek (Kapitel 5)

nunchuck_funcs.h

/* * Nunchuk functions -- Talk to a Wii Nunchuk * * This library is from the Bionic Arduino course : * http://todbot.com/blog/bionicarduino/ * * 2007 Tod E. Kurt, http://todbot.com/blog/ * * The Wii Nunchuk reading code originally from Windmeadow Labs * http://www.windmeadow.com/node/42 */#if ARDUINO >= 100 #include "Arduino.h"#else #include "WProgram.h"#endifstatic uint8_t nunchuck_buf[6]; // array to store nunchuk data,// Uses port C (analog in) pins as power & ground for Nunchukstatic void nunchuck_setpowerpins(){#define pwrpin PORTC3#define gndpin PORTC2 DDRC |= _BV(pwrpin) | _BV(gndpin); PORTC &=~ _BV(gndpin); PORTC |= _BV(pwrpin); delay(100); // wait for ...

Get Arduino - Praxiseinstieg now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.