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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.