SCLOrkWiimote offers an abstraction around raw Bluetooth HID packet communication with the Wiimote. It was developed and tested on Linux. MacOS support is unknown, and the HID library is not currently supported on Windows.
Creates a new SCLOrkWiimote instance and returns it. There is currently only one supported instance of SCLOrkWiimote per computer, so if the SCLOrkWiimote instance has already been created, this method will return that instance. By default the accelerometer is disabled when the SCLOrkWiimote object is first created.
Returns a boolean which is true if there is a Wiimote detected as connected to the host computer.
Provide a function to be called whenever a button press or release is detected.
A function to call. The function will be called with three arguments. The first argument is a symbol, and will be one of:
\dPadLeft |
\dPadRight |
\dPadDown |
\dPadUp |
\plus |
\minus |
\one |
\two |
\home |
\a |
\b |
depending on which button on the Wiimote has changed state. The second argument is a boolean which will be true if the button has been pressed, and false if the button has been released. The third and final argument is the SCLOrkWiimote instance that detected the button press.
Returns a boolean. If true the accelerometer is currently enabled. If false, it is not.
Returns the Bus number that represents the 3-channel bus holding the x,y, and z accelerometer values respectively. The values are updated at approximately 200Hz and range from -1 to +1.
Returns a boolean. If true the battery is critically low on the Wiimote and should be replaced.
Returns a number between 0 and 1 indicating the current percentage on the battery level.
Get current state or set the state of the 4 LEDs on the bottom of the front face of the Wiimote. The value is an integer using the first four bits to control the light states. See the examples below for some help setting and clearing bits to control lights.
A boolean controlling the state of the rumble motor inside the Wiimote. If true, the rumble motor is enabled. If false it is disabled.
An IdentityDictionary containing the current states of the buttons. The keys are the names of the buttons as documented in the onButton
method, the values are booleans that are true if the button is pressed or false if not pressed.
If the accelerometer is enabled, returns the current value of the x accelerometer.
If the accelerometer is enabled, returns the current value of the y accelerometer.
If the accelerometer is enabled, returns the current value of the z accelerometer.
Enables accelerometer reporting on the Wiimote. The accelerometer reports back 3-axis acceleration data at roughly 200Hz, which drains the battery much faster than when just reporting the buttons. Therefore the accelerometer is disabled by default. In an effort to increase efficiency the data are sent directly to the synthesis server on a control Bus, and can be accessed in SynthDefs with the InBus UGen. If accessing in the language the values are continuously updated and can be accessed by polling the values of the xAccel
, yAccel
, and zAccel
variables.
server |
An optional Server argument. If not provided, the class uses |
Turns off the accelerometer reporting on the Wiimote, to save the battery.
Disconnect from the Wiimote from SuperCollider and free the associated resources. If the accelerometer is required again, it can be re-enabled with another call to enableAccelerometer
.