Component: Formula AllCode API (AllCode)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd
Version 1.2
Category AllCode


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.

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

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

Backwards

Fc9-comp-macro.png Backwards
Drives the robot backwards - waits for the distance to be traversed before returning 
Fc9-u16-icon.png - UINT Distance
Distance in mm 
Fc9-void-icon.png - VOID Return


CardBitmap

Fc9-comp-macro.png CardBitmap
Displays a monochrome bitmap read from the card on the LCD 
Fc9-u8-icon.png - BYTE X
Range 0-127 
Fc9-u8-icon.png - BYTE Y
Range 0-31 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


CardCreate

Fc9-comp-macro.png CardCreate
Attempts to create a file on the SD card 255=Error, 1=File Already Exists, 0=Create OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


CardErase

Fc9-comp-macro.png CardErase
Attempts to delete an existing file on the SD card 255=Error, 1=File not found, 0=Delete OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


CardInit

Fc9-comp-macro.png CardInit
Attempts to startup the SD card 255=No Card, 254=Init Fail, 0=Init OK 
Fc9-u8-icon.png - BYTE Return


CardOpen

Fc9-comp-macro.png CardOpen
Attempts to open an existing file on the SD card 255=Error, 1=File not found, 0=Open OK 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


CardPlayback

Fc9-comp-macro.png CardPlayback
Plays back a .Wav file audio stream from the card 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


CardReadByte

Fc9-comp-macro.png CardReadByte
Reads a byte from the currently open file. Starts at the beginning of the file and auto increments to the end 
Fc9-u8-icon.png - BYTE Return


CardRecordMic

Fc9-comp-macro.png CardRecordMic
Records an audio stream on the card from the microphone 
Fc9-u8-icon.png - BYTE BitDepth
0=8-bit, 1=16-bit 
Fc9-u8-icon.png - BYTE SampleRate
Sample Rate 0=8KHz, 1=16KHz 
Fc9-u16-icon.png - UINT RecordTime
Time to record for in seconds, Range 0-65535 
Fc9-string-icon.png - STRING Filename
 
Fc9-u8-icon.png - BYTE Return


CardWriteByte

Fc9-comp-macro.png CardWriteByte
Appends a byte to the end of the currently open file  
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


EncoderRead

Fc9-comp-macro.png EncoderRead
Reads one of the motor encoder counters. Approx 0.328296mm of travel per encoder unit. 
Fc9-u8-icon.png - BYTE index
0=Left, 1=Right 
Fc9-u16-icon.png - UINT Return


EncoderReset

Fc9-comp-macro.png EncoderReset
Resets the motor encoder counters 
Fc9-void-icon.png - VOID Return


Forwards

Fc9-comp-macro.png Forwards
Drives the robot forwards - waits for the distance to be traversed before returning 
Fc9-u16-icon.png - UINT Distance
Distance in mm 
Fc9-void-icon.png - VOID Return


GetConsoleHandle

Fc9-comp-macro.png GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
Fc9-h32-icon.png - HANDLE Return


GetProp

Fc9-comp-macro.png GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-string-icon.png - STRING Return


LCDBacklight

Fc9-comp-macro.png LCDBacklight
Allows the LCD backlight brighntess to be adjusted 
Fc9-u8-icon.png - BYTE Intensity
Range 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness 
Fc9-void-icon.png - VOID Return


LCDClear

Fc9-comp-macro.png LCDClear
Clears the LCD 
Fc9-void-icon.png - VOID Return


LCDDrawLine

Fc9-comp-macro.png LCDDrawLine
Allows a single pixel width line to be drawn on the LCD 
Fc9-u8-icon.png - BYTE X1
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y1
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE X2
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y2
Y Pixel 0-31 
Fc9-void-icon.png - VOID Return


LCDDrawPixel

Fc9-comp-macro.png LCDDrawPixel
Allows a single pixel on the LCD to be set or cleared 
Fc9-u8-icon.png - BYTE X
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE State
0=White (Off), 1=Black (On) 
Fc9-void-icon.png - VOID Return


LCDDrawRect

Fc9-comp-macro.png LCDDrawRect
Allows a rectangle to be drawn on the LCD 
Fc9-u8-icon.png - BYTE X1
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y1
Y Pixel 0-31 
Fc9-u8-icon.png - BYTE X2
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y2
Y Pixel 0-31 
Fc9-void-icon.png - VOID Return


LCDPrintNumber

Fc9-comp-macro.png LCDPrintNumber
Prints a 16-bit signed number to the LCD 
Fc9-u8-icon.png - BYTE X
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y
LCD Y coordinate 0-31 
Fc9-s16-icon.png - INT Number
Range -32768 to 32767 
Fc9-void-icon.png - VOID Return


LCDPrintString

Fc9-comp-macro.png LCDPrintString
Prints a string to the LCD 
Fc9-u8-icon.png - BYTE X
X Pixel 0-127 
Fc9-u8-icon.png - BYTE Y
LCD Y Coordinate 0-31 
Fc9-string-icon.png - STRING Data
 
Fc9-void-icon.png - VOID Return


LCDVerbose

Fc9-comp-macro.png LCDVerbose
Allows the LCD to automatically report the API commands as they get processed. Default - verbose on 
Fc9-u8-icon.png - BYTE State
0=Off 1=On 
Fc9-void-icon.png - VOID Return


LEDOff

Fc9-comp-macro.png LEDOff
Clears a single LED 0-7 
Fc9-u8-icon.png - BYTE index
Range: 0-7 
Fc9-void-icon.png - VOID Return


LEDOn

Fc9-comp-macro.png LEDOn
Sets a single LED 0-7 
Fc9-u8-icon.png - BYTE index
Range: 0-7 
Fc9-void-icon.png - VOID Return


LEDWrite

Fc9-comp-macro.png LEDWrite
Sets the value of the LEDs as an 8-bit output 
Fc9-u8-icon.png - BYTE Value
LED value 0=All Off, 255 = All On 
Fc9-void-icon.png - VOID Return


Left

Fc9-comp-macro.png Left
Rotates the robot left - waits for the angle to be traversed before returning 
Fc9-u16-icon.png - UINT Angle
Angle to turn in degrees 
Fc9-void-icon.png - VOID Return


PlayNote

Fc9-comp-macro.png PlayNote
Plays a note using the speaker on the FA 
Fc9-u16-icon.png - UINT Note
Range 1 to 65535 in Hz 
Fc9-u16-icon.png - UINT Delay
Number of milliseconds to play the note for 
Fc9-void-icon.png - VOID Return


ReadAllSensors

Fc9-comp-macro.png ReadAllSensors
Samples all of the robot's sensors at once, storing the values locally 
Fc9-void-icon.png - VOID Return


ReadAllValue

Fc9-comp-macro.png ReadAllValue
Reads a single value stored from the read all command Index dictates which sensor value to read 
Fc9-u8-icon.png - BYTE Index
0=SW, 1-8=IR, 9-10=Line, 11=Light, 12=Mic, 13-15=Accel 
Fc9-u16-icon.png - UINT Return


ReadAxis

Fc9-comp-macro.png ReadAxis
Reads a single X/Y/Z axis from the accelerometer sensor.  
Fc9-u8-icon.png - BYTE index
0=X, 1=Y, 2=Z 
Fc9-s16-icon.png - INT Return


ReadBearing

Fc9-comp-macro.png ReadBearing
Reads the compass bearing based on the degrees clockwise from magnetic north. 
Fc9-s16-icon.png - INT Return


ReadIR

Fc9-comp-macro.png ReadIR
Reads an IR sensor 0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
Fc9-u8-icon.png - BYTE index
0=Left, 1=FrontLeft, 2=Front, 3=FrontRight, 4=Right, 5=RearRight, 6=Rear, 7=RearLeft 
Fc9-u16-icon.png - UINT Return


ReadLight

Fc9-comp-macro.png ReadLight
Reads the light sensor 0-4095 - 4095 = Max Brightness 
Fc9-u16-icon.png - UINT Return


ReadLine

Fc9-comp-macro.png ReadLine
Reads one of the IR line sensors 0-1 0=Left, 1=Right 
Fc9-u8-icon.png - BYTE index
0=Left, 1=Right 
Fc9-u16-icon.png - UINT Return


ReadMic

Fc9-comp-macro.png ReadMic
Reads the microphone sensor 0 - 4095 
Fc9-u16-icon.png - UINT Return


ReadSwitch

Fc9-comp-macro.png ReadSwitch
Read the switch value 
Fc9-u8-icon.png - BYTE index
0 (left) or 1 (right) 
Fc9-u8-icon.png - BYTE Return


Right

Fc9-comp-macro.png Right
Rotates the robot right - waits for the angle to be traversed before returning 
Fc9-u16-icon.png - UINT Angle
Angle to turn in degrees 
Fc9-void-icon.png - VOID Return


SampleAccel

Fc9-comp-macro.png SampleAccel
Samples the accelerometer 0 = no new data, 1 = new data available 
Fc9-u8-icon.png - BYTE Return


SampleMag

Fc9-comp-macro.png SampleMag
Samples the magnetometer 0 = no new data, 1 = new data available 
Fc9-u8-icon.png - BYTE Return


ServoAutoMoveToPosition

Fc9-comp-macro.png ServoAutoMoveToPosition
Allows one of the servo positions to move gradually to a new position 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-u8-icon.png - BYTE Position
Range 0-255 
Fc9-void-icon.png - VOID Return


ServoDisable

Fc9-comp-macro.png ServoDisable
Allows one of the servo outputs 0-3 to be disabled 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-void-icon.png - VOID Return


ServoEnable

Fc9-comp-macro.png ServoEnable
Allows one of the servo outputs 0-3 to be enabled 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-void-icon.png - VOID Return


ServoSetAutoMoveSpeed

Fc9-comp-macro.png ServoSetAutoMoveSpeed
Changes the speed of the auto movements Default - 1 
Fc9-u8-icon.png - BYTE Speed
Range 1-50 
Fc9-void-icon.png - VOID Return


ServoSetPosition

Fc9-comp-macro.png ServoSetPosition
Allows one of the servo positions to be assigned 
Fc9-u8-icon.png - BYTE Channel
Range 0-3 
Fc9-u8-icon.png - BYTE Position
Range 0-255 
Fc9-void-icon.png - VOID Return


SetLogoSpeed

Fc9-comp-macro.png SetLogoSpeed
Sets the speed of logo movements 
Fc9-u8-icon.png - BYTE Speed
Logo Speed 1-100 - Default 40 
Fc9-void-icon.png - VOID Return


SetMotors

Fc9-comp-macro.png SetMotors
Sets the motor speeds without feedback Range -100 to 100 
Fc9-s16-icon.png - INT Left
Range -100 to 100 
Fc9-s16-icon.png - INT Right
Range -100 to 100 
Fc9-void-icon.png - VOID Return


SetProp

Fc9-comp-macro.png SetProp
Allows the COM port property to be set from a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-u32-icon.png - ULONG PropVal
 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png COM Port
Selects which port to communicate with, only lists ports which are currently available.  
Fc9-type-7-icon.png Refresh COM Ports
When set to yes the COM port list is rescanned for newly connected or available ports. Note that refreshing the ports list may take a few seconds depending on the number of connected ports. 
Fc9-type-14-icon.png Baud
Baud rate passed to the COM port to control the rate of data. 
Fc9-type-10-icon.png Label