Difference between revisions of "Component: Formula AllCode API (AllCode)"
From Flowcode Help
Jump to navigationJump to search| Line 14: | Line 14: | ||
| ==Formula AllCode API component== | ==Formula AllCode API component== | ||
| A simulation only component to allow the Formula AllCode robot to be controlled via it's  API interface and Bluetooth data connection without having to compile or re-program the robot. | A simulation only component to allow the Formula AllCode robot to be controlled via it's  API interface and Bluetooth data connection without having to compile or re-program the robot. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| ==Detailed description== | ==Detailed description== | ||
| Line 1,083: | Line 1,077: | ||
| | colspan="2" |   | | colspan="2" |   | ||
| |} | |} | ||
| + | |||
| + | ==Component Source Code== | ||
| + | |||
| + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_FormulaAllCode_API.fcsx FC_Comp_Source_FormulaAllCode_API.fcsx] | ||
| + | |||
| + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_FormulaAllCode_API.fcsx FC_Comp_Source_FormulaAllCode_API.fcsx] | ||
Latest revision as of 09:59, 12 August 2024
| Author | Matrix Ltd | 
| Version | 1.2 | 
| Category | AllCode | 
Contents
- 1 Formula AllCode API component
- 2 Detailed description
- 3 Examples
- 4 Macro reference
- 4.1 Backwards
- 4.2 CardBitmap
- 4.3 CardCreate
- 4.4 CardErase
- 4.5 CardInit
- 4.6 CardOpen
- 4.7 CardPlayback
- 4.8 CardReadByte
- 4.9 CardRecordMic
- 4.10 CardWriteByte
- 4.11 EncoderRead
- 4.12 EncoderReset
- 4.13 Forwards
- 4.14 GetConsoleHandle
- 4.15 GetProp
- 4.16 LCDBacklight
- 4.17 LCDClear
- 4.18 LCDDrawLine
- 4.19 LCDDrawPixel
- 4.20 LCDDrawRect
- 4.21 LCDPrintNumber
- 4.22 LCDPrintString
- 4.23 LCDVerbose
- 4.24 LEDOff
- 4.25 LEDOn
- 4.26 LEDWrite
- 4.27 Left
- 4.28 PlayNote
- 4.29 ReadAllSensors
- 4.30 ReadAllValue
- 4.31 ReadAxis
- 4.32 ReadBearing
- 4.33 ReadIR
- 4.34 ReadLight
- 4.35 ReadLine
- 4.36 ReadMic
- 4.37 ReadSwitch
- 4.38 Right
- 4.39 SampleAccel
- 4.40 SampleMag
- 4.41 ServoAutoMoveToPosition
- 4.42 ServoDisable
- 4.43 ServoEnable
- 4.44 ServoSetAutoMoveSpeed
- 4.45 ServoSetPosition
- 4.46 SetLogoSpeed
- 4.47 SetMotors
- 4.48 SetProp
 
- 5 Property reference
- 6 Component Source Code
Formula AllCode API component
A simulation only component to allow the Formula AllCode robot to be controlled via it's API interface and Bluetooth data connection without having to compile or re-program the robot.
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
Backwards
|   | Backwards | 
| Drives the robot backwards - waits for the distance to be traversed before returning | |
|  - UINT | Distance | 
| Distance in mm | |
|  - VOID | Return | 
CardBitmap
|   | CardBitmap | 
| Displays a monochrome bitmap read from the card on the LCD | |
|  - BYTE | X | 
| Range 0-127 | |
|  - BYTE | Y | 
| Range 0-31 | |
|  - STRING | Filename | 
|  - BYTE | Return | 
CardCreate
|   | CardCreate | 
| Attempts to create a file on the SD card 255=Error, 1=File Already Exists, 0=Create OK | |
|  - STRING | Filename | 
|  - BYTE | Return | 
CardErase
|   | CardErase | 
| Attempts to delete an existing file on the SD card 255=Error, 1=File not found, 0=Delete OK | |
|  - STRING | Filename | 
|  - BYTE | Return | 
CardInit
|   | CardInit | 
| Attempts to startup the SD card 255=No Card, 254=Init Fail, 0=Init OK | |
|  - BYTE | Return | 
CardOpen
|   | CardOpen | 
| Attempts to open an existing file on the SD card 255=Error, 1=File not found, 0=Open OK | |
|  - STRING | Filename | 
|  - BYTE | Return | 
CardPlayback
|   | CardPlayback | 
| Plays back a .Wav file audio stream from the card | |
|  - STRING | Filename | 
|  - BYTE | Return | 
CardReadByte
|   | CardReadByte | 
| Reads a byte from the currently open file. Starts at the beginning of the file and auto increments to the end | |
|  - BYTE | Return | 
CardRecordMic
CardWriteByte
|   | CardWriteByte | 
| Appends a byte to the end of the currently open file | |
|  - BYTE | Data | 
|  - VOID | Return | 
EncoderRead
|   | EncoderRead | 
| Reads one of the motor encoder counters. Approx 0.328296mm of travel per encoder unit. | |
|  - BYTE | index | 
| 0=Left, 1=Right | |
|  - UINT | Return | 
EncoderReset
|   | EncoderReset | 
| Resets the motor encoder counters | |
|  - VOID | Return | 
Forwards
|   | Forwards | 
| Drives the robot forwards - waits for the distance to be traversed before returning | |
|  - UINT | Distance | 
| Distance in mm | |
|  - VOID | Return | 
GetConsoleHandle
|   | GetConsoleHandle | 
| Gets the handle to the console allowing data displaying on the panel etc. | |
|  - HANDLE | Return | 
GetProp
|   | GetProp | 
| Allows the property filter for the COM port list to be copied to a parent component. | |
|  - STRING | PropName | 
|  - STRING | Return | 
LCDBacklight
|   | LCDBacklight | 
| Allows the LCD backlight brighntess to be adjusted | |
|  - BYTE | Intensity | 
| Range 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness | |
|  - VOID | Return | 
LCDClear
|   | LCDClear | 
| Clears the LCD | |
|  - VOID | Return | 
LCDDrawLine
|   | LCDDrawLine | 
| Allows a single pixel width line to be drawn on the LCD | |
|  - BYTE | X1 | 
| X Pixel 0-127 | |
|  - BYTE | Y1 | 
| Y Pixel 0-31 | |
|  - BYTE | X2 | 
| X Pixel 0-127 | |
|  - BYTE | Y2 | 
| Y Pixel 0-31 | |
|  - VOID | Return | 
LCDDrawPixel
|   | LCDDrawPixel | 
| Allows a single pixel on the LCD to be set or cleared | |
|  - BYTE | X | 
| X Pixel 0-127 | |
|  - BYTE | Y | 
| Y Pixel 0-31 | |
|  - BYTE | State | 
| 0=White (Off), 1=Black (On) | |
|  - VOID | Return | 
LCDDrawRect
|   | LCDDrawRect | 
| Allows a rectangle to be drawn on the LCD | |
|  - BYTE | X1 | 
| X Pixel 0-127 | |
|  - BYTE | Y1 | 
| Y Pixel 0-31 | |
|  - BYTE | X2 | 
| X Pixel 0-127 | |
|  - BYTE | Y2 | 
| Y Pixel 0-31 | |
|  - VOID | Return | 
LCDPrintNumber
|   | LCDPrintNumber | 
| Prints a 16-bit signed number to the LCD | |
|  - BYTE | X | 
| X Pixel 0-127 | |
|  - BYTE | Y | 
| LCD Y coordinate 0-31 | |
|  - INT | Number | 
| Range -32768 to 32767 | |
|  - VOID | Return | 
LCDPrintString
|   | LCDPrintString | 
| Prints a string to the LCD | |
|  - BYTE | X | 
| X Pixel 0-127 | |
|  - BYTE | Y | 
| LCD Y Coordinate 0-31 | |
|  - STRING | Data | 
|  - VOID | Return | 
LCDVerbose
|   | LCDVerbose | 
| Allows the LCD to automatically report the API commands as they get processed. Default - verbose on | |
|  - BYTE | State | 
| 0=Off 1=On | |
|  - VOID | Return | 
LEDOff
|   | LEDOff | 
| Clears a single LED 0-7 | |
|  - BYTE | index | 
| Range: 0-7 | |
|  - VOID | Return | 
LEDOn
|   | LEDOn | 
| Sets a single LED 0-7 | |
|  - BYTE | index | 
| Range: 0-7 | |
|  - VOID | Return | 
LEDWrite
|   | LEDWrite | 
| Sets the value of the LEDs as an 8-bit output | |
|  - BYTE | Value | 
| LED value 0=All Off, 255 = All On | |
|  - VOID | Return | 
Left
|   | Left | 
| Rotates the robot left - waits for the angle to be traversed before returning | |
|  - UINT | Angle | 
| Angle to turn in degrees | |
|  - VOID | Return | 
PlayNote
|   | PlayNote | 
| Plays a note using the speaker on the FA | |
|  - UINT | Note | 
| Range 1 to 65535 in Hz | |
|  - UINT | Delay | 
| Number of milliseconds to play the note for | |
|  - VOID | Return | 
ReadAllSensors
|   | ReadAllSensors | 
| Samples all of the robot's sensors at once, storing the values locally | |
|  - VOID | Return | 
ReadAllValue
|   | ReadAllValue | 
| Reads a single value stored from the read all command Index dictates which sensor value to read | |
|  - BYTE | Index | 
| 0=SW, 1-8=IR, 9-10=Line, 11=Light, 12=Mic, 13-15=Accel | |
|  - UINT | Return | 
ReadAxis
|   | ReadAxis | 
| Reads a single X/Y/Z axis from the accelerometer sensor. | |
|  - BYTE | index | 
| 0=X, 1=Y, 2=Z | |
|  - INT | Return | 
ReadBearing
|   | ReadBearing | 
| Reads the compass bearing based on the degrees clockwise from magnetic north. | |
|  - INT | Return | 
ReadIR
ReadLight
|   | ReadLight | 
| Reads the light sensor 0-4095 - 4095 = Max Brightness | |
|  - UINT | Return | 
ReadLine
|   | ReadLine | 
| Reads one of the IR line sensors 0-1 0=Left, 1=Right | |
|  - BYTE | index | 
| 0=Left, 1=Right | |
|  - UINT | Return | 
ReadMic
|   | ReadMic | 
| Reads the microphone sensor 0 - 4095 | |
|  - UINT | Return | 
ReadSwitch
|   | ReadSwitch | 
| Read the switch value | |
|  - BYTE | index | 
| 0 (left) or 1 (right) | |
|  - BYTE | Return | 
Right
|   | Right | 
| Rotates the robot right - waits for the angle to be traversed before returning | |
|  - UINT | Angle | 
| Angle to turn in degrees | |
|  - VOID | Return | 
SampleAccel
|   | SampleAccel | 
| Samples the accelerometer 0 = no new data, 1 = new data available | |
|  - BYTE | Return | 
SampleMag
|   | SampleMag | 
| Samples the magnetometer 0 = no new data, 1 = new data available | |
|  - BYTE | Return | 
ServoAutoMoveToPosition
|   | ServoAutoMoveToPosition | 
| Allows one of the servo positions to move gradually to a new position | |
|  - BYTE | Channel | 
| Range 0-3 | |
|  - BYTE | Position | 
| Range 0-255 | |
|  - VOID | Return | 
ServoDisable
|   | ServoDisable | 
| Allows one of the servo outputs 0-3 to be disabled | |
|  - BYTE | Channel | 
| Range 0-3 | |
|  - VOID | Return | 
ServoEnable
|   | ServoEnable | 
| Allows one of the servo outputs 0-3 to be enabled | |
|  - BYTE | Channel | 
| Range 0-3 | |
|  - VOID | Return | 
ServoSetAutoMoveSpeed
|   | ServoSetAutoMoveSpeed | 
| Changes the speed of the auto movements Default - 1 | |
|  - BYTE | Speed | 
| Range 1-50 | |
|  - VOID | Return | 
ServoSetPosition
|   | ServoSetPosition | 
| Allows one of the servo positions to be assigned | |
|  - BYTE | Channel | 
| Range 0-3 | |
|  - BYTE | Position | 
| Range 0-255 | |
|  - VOID | Return | 
SetLogoSpeed
|   | SetLogoSpeed | 
| Sets the speed of logo movements | |
|  - BYTE | Speed | 
| Logo Speed 1-100 - Default 40 | |
|  - VOID | Return | 
SetMotors
|   | SetMotors | 
| Sets the motor speeds without feedback Range -100 to 100 | |
|  - INT | Left | 
| Range -100 to 100 | |
|  - INT | Right | 
| Range -100 to 100 | |
|  - VOID | Return | 
SetProp
|   | SetProp | 
| Allows the COM port property to be set from a parent component. | |
|  - STRING | PropName | 
|  - ULONG | PropVal | 
|  - VOID | Return | 
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_FormulaAllCode_API.fcsx
Please click here to view the component source code (Beta): FC_Comp_Source_FormulaAllCode_API.fcsx





