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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access