Difference between revisions of "Component: Wii Nunchuk (Movement Orientation)"
From Flowcode Help
Jump to navigationJump to search| Line 73: | Line 73: | ||
''<span style="color:red;">No additional examples</span>'' | ''<span style="color:red;">No additional examples</span>'' | ||
| + | |||
| + | |||
| Line 180: | Line 182: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
| − | |||
| − | |||
Revision as of 12:22, 3 February 2023
| Author | Matrix TSL |
| Version | 2.0 |
| Category | Movement Orientation |
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.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_temp/WiiNunchuck.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_temp/WiiNunchuck.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
Initialise
| Initialise | |
| Sets up up the communication bus and initialises the accelerometer module. Returns 1 for success and 0 for fail. | |
| Return | |
ReadAccelerometer
| ReadAccelerometer | |
| Reads a single Accelerometer axis | |
| Axis | |
| 0=X, 1=Y, 2=Z | |
| Return | |
ReadJoystick
| ReadJoystick | |
| Reads a single joystick axis | |
| Axis | |
| 0=X, 1=Y | |
| Return | |
ReadSwitch
| ReadSwitch | |
| Reads one of the nunchuck switches | |
| Switch | |
| 0=Z, 1=C | |
| Return | |
Sample
| Sample | |
| Reads from the nunchuck and updates the local variables. | |
| Return | |
SimReset1G
| SimReset1G | |
| Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was sitting completely horizontal. | |
| Return | |