Difference between revisions of "Component: Wii Nunchuk (General Input)"
From Flowcode Help
Jump to navigationJump to search(2 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
==Wii Nunchuk component== | ==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. | 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 Pack== | ||
+ | |||
+ | FREE | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 24: | Line 34: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 61: | Line 77: | ||
| colspan="2" | 0=X, 1=Y | | colspan="2" | 0=X, 1=Y | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] - | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 79: | Line 95: | ||
| colspan="2" | 0=Z, 1=C | | colspan="2" | 0=Z, 1=C | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] - | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 110: | Line 126: | ||
| colspan="2" | 0=X, 1=Y, 2=Z | | colspan="2" | 0=X, 1=Y, 2=Z | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:]] - | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
Line 148: | Line 164: | ||
| colspan="2" | Decides if encryption should be active or disabled | | colspan="2" | Decides if encryption should be active or disabled | ||
|- | |- | ||
− | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="background-color:# | ||
− | | width="90%" style="background-color:# | ||
|- | |- | ||
|- | |- | ||
Line 197: | Line 198: | ||
| colspan="2" | 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. | | colspan="2" | 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. | ||
|- | |- | ||
− | | width="10%" align="center" style="background-color:# | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] |
− | | width="90%" style="background-color:# | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation |
|- | |- | ||
|- | |- |
Latest revision as of 17:23, 9 November 2022
Author | Matrix TSL |
Version | 2.0 |
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.
Component Pack
FREE
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Downloadable 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. | |
![]() |
Return |
![]() |
ReadJoystick |
Reads a single joystick axis | |
![]() |
Axis |
0=X, 1=Y | |
![]() |
Return |
![]() |
ReadSwitch |
Reads one of the nunchuck switches | |
![]() |
Switch |
0=Z, 1=C | |
![]() |
Return |
![]() |
Sample |
Reads from the nunchuck and updates the local variables. | |
![]() |
Return |
![]() |
ReadAccelerometer |
Reads a single Accelerometer axis | |
![]() |
Axis |
0=X, 1=Y, 2=Z | |
![]() |
Return |
![]() |
Initialise |
Sets up up the communication bus and initialises the accelerometer module. Returns 1 for success and 0 for fail. | |
![]() |
Return |