Anhang D: Listings

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

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" #endif static uint8_t nunchuck_buf[6]; // array to store nunchuk data, // Uses port C (analog in) pins as power & ground for Nunchuk static void nunchuck_setpowerpins() { #define pwrpin PORTC3 #define gndpin PORTC2 DDRC |= _BV(pwrpin) | _BV(gndpin); PORTC &=~ _BV(gndpin); PORTC |= _BV(pwrpin); ...

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.