Component: Quadrature Encoder (General Input)
From Flowcode Help
Jump to navigationJump to search
Author | Matrix TSL |
Version | 1.4 |
Category | General Input |
Contents
Quadrature Encoder component
Quadrature Encoder component implements a rotary encoder connected to two pins. Quadrature Encoders provides incremental positioning rather than absolute positioning.
Detailed description
No detailed description exists yet for this component
Examples
Polling
Example program showing how to use a quadrature encoder component using a polling method. Quad_Encoder_Test
Timer Interrupt Based Polling
Example program showing how to use a quadrature encoder component using a polling method via a timer interrupt. Quad_Encoder_Timer
Interrupt On Change
Example program showing how to use a quadrature encoder component using a interrupt on pin state change interrupt (IOC). Quad_Encoder_IOC
Downloadable macro reference
CheckForChanges | |
Polling function to check changes Returns 1 for chaged, 0 for no change, 255 for error | |
- BYTE | Return |
Disable | |
Disables the use of the quad encoder Once this ist called, the read functions will return zeros until the next Enable() call | |
- VOID | Return |
WriteCounter32 | |
Sets the value of the internal count variable. Range: -2147483648 to 2147483647 | |
[[File:]] - | Value |
Range: -2147483648 to 2147483647 | |
- VOID | Return |
Enable | |
Enables the use of the quad encoder If this is not called, the read functions will return zeros | |
- VOID | Return |
ReadCounter | |
Reads the current dial counter This is a counter from -32768 to 32767 | |
[[File:]] - | Return |
WriteCounter | |
Sets the value of the internal count variable. Range: -32768 to 32767 | |
[[File:]] - | Value |
Range: -32768 to 32767 | |
- VOID | Return |
ResetCounter | |
Resets the current dial counter to zero | |
- VOID | Return |
ReadCounter32 | |
Reads the current dial counter as a 32-bit value This is a counter from -2147483648 to 2147483647 | |
[[File:]] - | Return |
SpinRight | |
Spins the formula flowcode on the spot in a clockwise direction as seen from above. | |
- BYTE | Power |
- VOID | Return |
CheckIR | |
Checks to see if a IR sensor is within the master threshold distance. | |
- BYTE | Sensor |
- BYTE | Return |
ReadIRSensor | |
Reads the analogue value from the specified IR distance sensor. | |
- BYTE | Sensor |
- UINT | Return |
SetMotors | |
Sets the speed and direction of the Formula Flowcode motors. | |
[[File:]] - | Left_Power |
Valid Range = -255 to 255 | |
[[File:]] - | Right_Power |
Valid Range = -255 to 255 | |
- VOID | Return |
Reverse | |
Drives both motors of the formula flowcode backwards with the power specified. | |
- BYTE | Power |
- VOID | Return |
WaitForSwitch | |
Waits for the specified switch to be pressed. | |
- BYTE | Switch |
- VOID | Return |
ReadLDR | |
Reads the current audio signal level from the on-board light sensor. | |
[[File:]] - | Return |
WriteLEDs | |
Allows control of all 8-LEDs on the front of the Formula Flowcode. | |
- BYTE | LED_Byte |
- VOID | Return |
Initialise | |
Starts up the formula flowcode PWM for motor control and performs the wait for button press | |
- VOID | Return |