Component: Formula AllCode (RB4420) (Robotics)
From Flowcode Help
(Redirected from Component: ID e3be641a 8808 4138 bee5 805fbbce468c)
Jump to navigationJump to searchAuthor | Matrix TSL |
Version | 1.3 |
Category | Robotics |
Contents
- 1 Formula AllCode component
- 2 Component Source Code
- 3 Detailed description
- 4 Examples
- 5 Macro reference
- 5.1 AudioAddToBuffer
- 5.2 AudioQueueLength
- 5.3 AudioReadFromBuffer
- 5.4 AudioStreamControl
- 5.5 BluetoothCheckConnection
- 5.6 BluetoothQueueLength
- 5.7 BluetoothReceive
- 5.8 BluetoothTransmit
- 5.9 BluetoothTransmitString
- 5.10 CheckIR
- 5.11 CheckLine
- 5.12 CheckUSB
- 5.13 EncoderReadCount
- 5.14 EncoderReset
- 5.15 Forward
- 5.16 Initialise
- 5.17 LCDBacklight
- 5.18 LCDClear
- 5.19 LCDDrawLine
- 5.20 LCDDrawRectangle
- 5.21 LCDPlotPixel
- 5.22 LCDPrintNumber
- 5.23 LCDPrintString
- 5.24 LCDSetBackgroundColour
- 5.25 LCDSetForegroundColour
- 5.26 LCDWriteByte
- 5.27 LEDOff
- 5.28 LEDOn
- 5.29 LEDWrite
- 5.30 LogoBackwards
- 5.31 LogoConfigure
- 5.32 LogoForwards
- 5.33 LogoSetSpeed
- 5.34 LogoTurnLeft
- 5.35 LogoTurnRight
- 5.36 PlayNote
- 5.37 ReadBattery
- 5.38 ReadIRSensor
- 5.39 ReadLDR
- 5.40 ReadLineSensor
- 5.41 ReadMic
- 5.42 ReadSwitch
- 5.43 Reverse
- 5.44 SetMotors
- 5.45 SpinLeft
- 5.46 SpinRight
- 5.47 Stop
- 5.48 WaitForSwitch
- 6 Property reference
Formula AllCode component
A component to allow all the features of the Formula AllCode robot to be investigated. Fully simulated component which can interact with simulated objects on the panel as well as control the real hardware.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_FA_Source_P4.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_FA_Source_P4.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Line Following
Line following example using the Formula AllCode, works with objects on the simulation panel and on the real hardware.
Simulation with the API component
An example showing how to use the API component to drive the robot in simulation.
Macro reference
AudioAddToBuffer
AudioAddToBuffer | |
Writes a value to the 16-bit audio output buffer. | |
- UINT | Data |
- VOID | Return |
AudioQueueLength
AudioQueueLength | |
Retreives the current length of valid data within the audio queue | |
- UINT | Return |
AudioReadFromBuffer
AudioReadFromBuffer | |
Allows the audio buffer to be used for other streaming data such as recording the mic. | |
- UINT | Return |
AudioStreamControl
BluetoothCheckConnection
BluetoothCheckConnection | |
Checks the status of the Bluetooth connection. Returns 0 for not paired and 1 for paired. | |
- BYTE | Return |
BluetoothQueueLength
BluetoothQueueLength | |
Reads the length of received Bluetooth data in bytes. | |
- UINT | Return |
BluetoothReceive
BluetoothReceive | |
Attempt to read a byte from the Bluetooth receive queue. | |
- BYTE | Return |
BluetoothTransmit
BluetoothTransmit | |
Sends a byte via the Bluetooth data connection. | |
- BYTE | Data |
- VOID | Return |
BluetoothTransmitString
BluetoothTransmitString | |
Sends a string via the Bluetooth data connection. | |
- STRING | Data |
- VOID | Return |
CheckIR
CheckLine
CheckUSB
CheckUSB | |
Checks to see if a USB cable is connected to the robot. Returns 0 for no connection and 1 for an active connection. | |
- BYTE | Return |
EncoderReadCount
EncoderReadCount | |
Reads one of the motor encoder counters. Each encoder count is equal to 0.314159 mm. | |
- BYTE | Channel |
0 = LeftCount, 1=RightCount | |
- UINT | Return |
EncoderReset
EncoderReset | |
Resets the encoder counters to 0 | |
- VOID | Return |
Forward
Forward | |
Drives both motors of the formula flowcode forwards with the power specified. | |
- BYTE | Power |
Amount of power to use to drive motor. Range 0-100 | |
- VOID | Return |
Initialise
Initialise | |
Starts up the Formula Allcode PWM for motor control and performs the wait for button press if enabled. | |
- VOID | Return |
LCDBacklight
LCDBacklight | |
Controls the brighness of the LCD backlight | |
- BYTE | Brightness |
Range: 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness | |
- VOID | Return |
LCDClear
LCDClear | |
Clears the contents of the graphical LCD. | |
- VOID | Return |
LCDDrawLine
LCDDrawLine | |
Draws a line on the LCD. | |
- BYTE | X1 |
Range 0-127 | |
- BYTE | Y1 |
Range 0-31 | |
- BYTE | X2 |
Range 0-127 | |
- BYTE | Y2 |
Range 0-31 | |
- VOID | Return |
LCDDrawRectangle
LCDPlotPixel
LCDPlotPixel | |
Allows a single pixel on the LCD to be set or cleared. | |
- BYTE | X |
Sets the X coordinate - Range 0-127 | |
- BYTE | Y |
Sets the Y coordinate - Range 0-31 | |
- VOID | Return |
LCDPrintNumber
LCDPrintString
LCDSetBackgroundColour
LCDSetBackgroundColour | |
Sets the pixel colour to drive the LCD. Default colour is 1 where a set pixel is black and the background is white. | |
- BYTE | Colour |
Range 0-1 : 0=White, 1=Black | |
- VOID | Return |
LCDSetForegroundColour
LCDSetForegroundColour | |
Sets the pixel colour to drive the LCD. Default colour is 1 where a set pixel is black and the background is white. | |
- BYTE | Colour |
Range 0-1 : 0=White, 1=Black | |
- VOID | Return |
LCDWriteByte
LCDWriteByte | |
- BYTE | Data |
- BYTE | X |
- BYTE | Y |
- VOID | Return |
LEDOff
LEDOff | |
Switches off a single LED on the front of the Formula Allcode. | |
- BYTE | LED |
Which LED to switch on, range 0-7 | |
- VOID | Return |
LEDOn
LEDOn | |
Switches on a single LED on the front of the Formula Allcode. | |
- BYTE | LED |
Which LED to switch on, range 0-7 | |
- VOID | Return |
LEDWrite
LEDWrite | |
Allows control of all 8-LEDs on the front of the Formula Allcode. | |
- BYTE | LED_Byte |
8-bit binary value to write to the 8 LEDs | |
- VOID | Return |
LogoBackwards
LogoConfigure
LogoForwards
LogoSetSpeed
LogoSetSpeed | |
Sets the cruise speed for LOGO type macros. Default speed 20%. | |
- BYTE | Speed |
Range 1-100, Default 60 | |
- VOID | Return |
LogoTurnLeft
LogoTurnRight
PlayNote
ReadBattery
ReadIRSensor
ReadLDR
ReadLineSensor
ReadMic
ReadMic | |
Reads the current audio signal level from the on-board microphone. Return value range: 0 to 4095 | |
- UINT | Return |
ReadSwitch
ReadSwitch | |
Reads the value of one of the switches from the front of the Formula Allcode. | |
- BYTE | Switch |
Which switch do we want to read 0=Left, 1=Right | |
- BYTE | Return |
Reverse
Reverse | |
Drives both motors of the formula flowcode backwards with the power specified. | |
- BYTE | Power |
Amount of power to use to drive motor. Range 0-100 | |
- VOID | Return |
SetMotors
SetMotors | |
Sets the speed and direction of the Formula Allcode motors. | |
- INT | Left |
Valid Range = -100 to 100 | |
- INT | Right |
Valid Range = -100 to 100 | |
- VOID | Return |
SpinLeft
SpinLeft | |
Spins the formula flowcode on the spot in an anticlockwise direction as seen from above. | |
- BYTE | Power |
Amount of power to use to drive motor. Range 0-100 | |
- VOID | Return |
SpinRight
SpinRight | |
Spins the formula flowcode on the spot in a clockwise direction as seen from above. | |
- BYTE | Power |
Amount of power to use to drive motor. Range 0-100 | |
- VOID | Return |
Stop
Stop | |
Stops both motors. | |
- VOID | Return |
WaitForSwitch
WaitForSwitch | |
Waits for the specified switch to be pressed. | |
- BYTE | Switch |
Which switch do we want to wait for 0=Left, 1=Right, 2=Either, 3=Both | |
- VOID | Return |