Difference between revisions of "Component: Wii Nunchuk (Movement Orientation)"

From Flowcode Help
Jump to navigationJump to search
 
Line 17: Line 17:
 
==Component Source Code==
 
==Component Source Code==
  
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/WiiNunchuck.fcfx FC_Comp_Source_temp/WiiNunchuck.fcfx]
+
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_WiiNunchuck.fcfx FC_Comp_Source_WiiNunchuck.fcfx]
  
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/WiiNunchuck.fcfx FC_Comp_Source_temp/WiiNunchuck.fcfx]
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_WiiNunchuck.fcfx FC_Comp_Source_WiiNunchuck.fcfx]
  
 
==Detailed description==
 
==Detailed description==
Line 73: Line 73:
  
 
''<span style="color:red;">No additional examples</span>''
 
''<span style="color:red;">No additional examples</span>''
 +
 +
  
  

Latest revision as of 13:13, 7 February 2023

Author Matrix TSL
Version 2.0
Category Movement Orientation


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_WiiNunchuck.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_WiiNunchuck.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

Initialise

Fc9-comp-macro.png Initialise
Sets up up the communication bus and initialises the accelerometer module. Returns 1 for success and 0 for fail. 
Fc9-u8-icon.png - BYTE Return


ReadAccelerometer

Fc9-comp-macro.png ReadAccelerometer
Reads a single Accelerometer axis 
Fc9-u8-icon.png - BYTE Axis
0=X, 1=Y, 2=Z 
Fc9-s16-icon.png - INT Return


ReadJoystick

Fc9-comp-macro.png ReadJoystick
Reads a single joystick axis 
Fc9-u8-icon.png - BYTE Axis
0=X, 1=Y 
Fc9-s16-icon.png - INT Return


ReadSwitch

Fc9-comp-macro.png ReadSwitch
Reads one of the nunchuck switches 
Fc9-u8-icon.png - BYTE Switch
0=Z, 1=C 
Fc9-bool-icon.png - BOOL Return


Sample

Fc9-comp-macro.png Sample
Reads from the nunchuck and updates the local variables.  
Fc9-void-icon.png - VOID Return


SimReset1G

Fc9-comp-macro.png SimReset1G
Resets the simulation to 0.0 on X and Y and 1.0 on Z as if the accelerometer was sitting completely horizontal. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-14-icon.png Bit Depth
The number of binary bits used to store the sensor's X,Y,Z readings. 
Fc9-type-7-icon.png Encryption
Decides if encryption should be active or disabled 
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
Channel selection 
Fc9-type-16-icon.png Baud Select
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
Baud rate to be used 
Fc9-type-5-icon.png SDA
Pin used for SDA (data signal) 
Fc9-type-5-icon.png SCL
Pin used for SCL (clock signal) 
Fc9-type-7-icon.png Stop Delay
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.  
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png Simulate Comms
Yes: Accelerometer data will come from the simulation component sliders. No: Accelerometer data will come from the CAL component - I2C or SPI - API etc