Using Our Nunchuk Class - Arduino Uno Quick Start Manual

Hide thumbs Also See for Arduino Uno:
Table of Contents

Advertisement

Scientific Applications Using Wii Equipment
Because of the Wii s accuracy and low price, many scientists use the Wii for things
other than gaming. Some hydrologists use it for measuring evaporation from a body
a
of water.
Usually, you d need equipment costing more than $500 to do that.
Some doctors at the University of Melbourne had a closer look at the Wii Balance
Board, because they were looking for a cheap device to help stroke victims recover.
They published a scientific paper verifying that the board s data is clinically compa-
rable to that of a lab-grade "force platform" for a fraction of the cost.
a.
http://www.wired.com/wiredscience/2009/12/wiimote-science/
b.
http://www.newscientist.com/article/mg20527435.300-wii-board-helps-physios-strike-a-balance-after-
strokes.html

Using Our Nunchuk Class

Let s use the
Nunchuk
class to see what data the controller actually returns:
Tinkering/NunchukDemo/NunchukDemo.ino
#include <Wire.h>
#include "nunchuk.h"
const unsigned int
BAUD_RATE = 19200;
Nunchuk nunchuk;
void
setup() {
Serial.begin(BAUD_RATE);
nunchuk.initialize();
}
void
loop() {
if
(nunchuk.update()) {
Serial.print(nunchuk.joystick_x());
Serial.print("
");
Serial.print(nunchuk.joystick_y());
Serial.print("
");
Serial.print(nunchuk.x_acceleration());
Serial.print("
");
Serial.print(nunchuk.y_acceleration());
Serial.print("
");
Serial.print(nunchuk.z_acceleration());
Serial.print("
");
Serial.print(nunchuk.z_button());
Serial.print("
");
Serial.println(nunchuk.c_button());
}
}
Chapter 9. Tinkering with the Wii Nunchuk
www.it-ebooks.info
152
b
report erratum
discuss

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Arduino Uno and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents