Component: Wii Nunchuk (General Input)
Author | Matrix TSL |
Version | 2.0 (Release) |
Category | General Input |
Contents
Wii Nunchuk component
A component to interface the Wii Nunchuck which features a 3-axis 10-bit Accelerometer A 2-axis 8-bit joystick and two digital button inputs. Interfaced using a standard I2C bus at 100KHz. Nunchuk must be powered at 3V3 to avoid damage.
Examples
No additional examples
Downloadable macro reference
ReadJoystick
Reads a single joystick axis
Parameters
- BYTE Axis
- 0=X, 1=Y
Return value
ReadSwitch
Reads one of the nunchuck switches
Parameters
- BYTE Switch
- 0=Z, 1=C
Return value
- BOOL : Returns true if the operation is a success, else false
Sample
Reads from the nunchuck and updates the local variables.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
ReadAccelerometer
Reads a single Accelerometer axis
Parameters
- BYTE Axis
- 0=X, 1=Y, 2=Z
Return value
Initialise
Sets up up the communication bus and initialises the accelerometer module.
Returns 1 for success and 0 for fail.
Parameters
- This macro has no parameters
Return value
Simulation macro reference
SimReset1G
Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was
sitting completely horizontal.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Property reference
Bit Depth
This property is of type Signed integer and can be referenced with the variable name bit_depth.
The number of binary bits used to store the sensor's X,Y,Z readings.
Encryption
This property is of type True or false and can be referenced with the variable name Encryption.
Decides if encryption should be active or disabled
Channel
This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c::CHANNEL.
Channel selection
Baud Select
This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c::BAUD_LIST.
Baud rate option selector
Baud Rate
This property is of type Signed integer and can be referenced with the variable name cal_i2c::BAUD.
Baud rate to be used
SDA
This property is of type Single digital pin and can be referenced with the variable name cal_i2c::SDA.
Pin used for SDA (data signal)
SCL
This property is of type Single digital pin and can be referenced with the variable name cal_i2c::SCL.
Pin used for SCL (clock signal)
Stop Delay
This property is of type True or false and can be referenced with the variable name cal_i2c::StopDel.
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not
a 10ms delay between an I2C stop event and the next I2C start event.
Most modern microcontrollers will not have a problem so this property can be disabled to speed up the
I2C communications.
Simulation GUI
This property is of type True or false and can be referenced with the variable name SimulationGUI.
Yes: Accelerometer data will come from the simulation component sliders.
No: Accelerometer data will come from the CAL component - I2C or SPI - Injector etc
Scope Traces
This property is of type True or false and can be referenced with the variable name cal_i2c::ScopeTraces.
Selects if the scope traces are automatically generated or not
Console Data
This property is of type True or false and can be referenced with the variable name cal_i2c::ConsoleData.
Selects if the console data is automatically generated or not
Injector
This property is of type Fixed list of ints and can be referenced with the variable name cal_i2c::Injector.
No additional information
Image
This property is of type Filename and can be referenced with the variable name shape1::Image.
No additional information