USB Host Shield 2.0
|
#include <Wii.h>
Public Member Functions | |
WII (BTD *p, bool pair=false) | |
BluetoothService implementation | |
virtual void | ACLData (uint8_t *ACLData) |
virtual void | Run () |
virtual void | Reset () |
virtual void | disconnect () |
Wii Controller functions | |
bool | getButtonPress (Button b) |
bool | getButtonClick (Button b) |
void | pair (void) |
uint8_t | getAnalogHat (Hat a) |
uint16_t | getAnalogHat (AnalogHat a) |
double | getPitch () |
double | getRoll () |
double | getYaw () |
void | setAllOff () |
void | setRumbleOff () |
void | setRumbleOn () |
void | setRumbleToggle () |
void | setLedRaw (uint8_t value) |
void | setLedOff (LED a) |
void | setLedOn (LED a) |
void | setLedToggle (LED a) |
void | setLedStatus () |
uint8_t | getBatteryLevel () |
uint8_t | getWiiState () |
void | attachOnInit (void(*funcOnInit)(void)) |
Wiimote IR camera functions | |
void | IRinitialize () |
uint16_t | getIRx1 () |
uint16_t | getIRy1 () |
uint8_t | getIRs1 () |
uint16_t | getIRx2 () |
uint16_t | getIRy2 () |
uint8_t | getIRs2 () |
uint16_t | getIRx3 () |
uint16_t | getIRy3 () |
uint8_t | getIRs3 () |
uint16_t | getIRx4 () |
uint16_t | getIRy4 () |
uint8_t | getIRs4 () |
bool | isIRCameraEnabled () |
Public Attributes | |
double | gyroPitch |
double | gyroRoll |
double | gyroYaw |
bool | wiimoteConnected |
bool | nunchuckConnected |
bool | motionPlusConnected |
bool | wiiUProControllerConnected |
double | wiimotePitch |
double | wiimoteRoll |
double | nunchuckPitch |
double | nunchuckRoll |
int16_t | accX |
int16_t | accY |
int16_t | accZ |
double | pitchGyroSpeed |
double | rollGyroSpeed |
double | yawGyroSpeed |
uint16_t | pitchGyroScale |
uint16_t | rollGyroScale |
uint16_t | yawGyroScale |
int16_t | gyroYawRaw |
int16_t | gyroRollRaw |
int16_t | gyroPitchRaw |
int16_t | gyroYawZero |
int16_t | gyroRollZero |
int16_t | gyroPitchZero |
This BluetoothService class implements support for the Wiimote including the Nunchuck and Motion Plus extension.
It also support the Wii U Pro Controller.
WII::WII | ( | BTD * | p, |
bool | pair = false |
||
) |
|
virtual |
Used to pass acldata to the services.
ACLData | Incoming acldata. |
Reimplemented from BluetoothService.
|
virtual |
Used to run part of the state maschine.
Reimplemented from BluetoothService.
|
virtual |
Use this to reset the service.
Reimplemented from BluetoothService.
|
virtual |
Used this to disconnect any of the controllers.
Reimplemented from BluetoothService.
bool WII::getButtonPress | ( | Button | b) |
getButtonPress(Button b) will return true as long as the button is held down.
While getButtonClick(Button b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).
bool WII::getButtonClick | ( | Button | b) |
getButtonPress(Button b) will return true as long as the button is held down.
While getButtonClick(Button b) will only return it once.
So you instance if you need to increase a variable once you would use getButtonClick(Button b), but if you need to drive a robot forward you would use getButtonPress(Button b).
|
inline |
uint8_t WII::getAnalogHat | ( | Hat | a) |
uint16_t WII::getAnalogHat | ( | AnalogHat | a) |
|
inline |
|
inline |
|
inline |
void WII::setAllOff | ( | ) |
void WII::setLedRaw | ( | uint8_t | value) |
void WII::setLedOff | ( | LED | a) |
void WII::setLedOn | ( | LED | a) |
void WII::setLedToggle | ( | LED | a) |
void WII::setLedStatus | ( | ) |
uint8_t WII::getBatteryLevel | ( | ) |
|
inline |
Return the Wiimote state.
|
inline |
void WII::IRinitialize | ( | ) |
Initialises the camera as per the steps from: http://wiibrew.org/wiki/Wiimote#IR_Camera
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Use this to check if the camera is enabled or not. If not call WII::IRinitialize to initialize the IR camera.
bool WII::wiimoteConnected |
bool WII::nunchuckConnected |
bool WII::motionPlusConnected |
bool WII::wiiUProControllerConnected |
double WII::wiimotePitch |
double WII::wiimoteRoll |
double WII::nunchuckPitch |
double WII::nunchuckRoll |
int16_t WII::accX |
int16_t WII::accY |
int16_t WII::accZ |
double WII::gyroPitch |
This is the pitch calculated by the gyro - use this to tune WII::pitchGyroScale.
double WII::gyroRoll |
This is the roll calculated by the gyro - use this to tune WII::rollGyroScale.
double WII::gyroYaw |
This is the yaw calculated by the gyro - use this to tune WII::yawGyroScale.
uint16_t WII::pitchGyroScale |
uint16_t WII::rollGyroScale |
uint16_t WII::yawGyroScale |
int16_t WII::gyroYawRaw |
int16_t WII::gyroRollRaw |
int16_t WII::gyroPitchRaw |
int16_t WII::gyroYawZero |
int16_t WII::gyroRollZero |
int16_t WII::gyroPitchZero |