2 Example sketch for the Wii Balance Board Bluetooth library - developed by Kristian Lauszus
3 For more information visit my blog: http://blog.tkjelectronics.dk/ or
4 send me an e-mail: kristianl@tkjelectronics.com
10 // Satisfy the IDE, which needs to see the include statment in the ino too.
12 #include <spi4teensy3.h>
17 //USBHub Hub1(&Usb); // Some dongles have a hub inside
19 BTD Btd(&Usb); // You have to create the Bluetooth Dongle instance like so
20 /* You can create the instance of the class in two ways */
21 WII Wii(&Btd, PAIR); // This will start an inquiry and then pair with your Wii Balance Board - you only have to do this once
22 //WII Wii(&Btd); // After that you can simply create the instance like so and then press the power button on the Wii Balance Board
26 #if !defined(__MIPSEL__)
27 while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
29 if (Usb.Init() == -1) {
30 Serial.print(F("\r\nOSC did not start"));
33 Serial.print(F("\r\nWii Balance Board Bluetooth Library Started"));
37 if (Wii.wiiBalanceBoardConnected) {
38 Serial.print(F("\r\nWeight: "));
39 for (uint8_t i = 0; i < 4; i++) {
40 Serial.print(Wii.getWeight((BalanceBoardEnum)i));
41 Serial.print(F("\t"));
43 Serial.print(F("Total Weight: "));
44 Serial.print(Wii.getTotalWeight());
45 if (Wii.getButtonClick(A)) {
46 Serial.print(F("\r\nA"));
47 //Wii.setLedToggle(LED1); // The Wii Balance Board has one LED as well