O'Reilly logo

Arduino - Praxiseinstieg by Thomas Brühlmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required