Jump to content

Component: Formula AllCode Dummy (RB4420) (Mechatronics): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(7 intermediate revisions by 2 users not shown)
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/FA_Source_P4_Dummy_Template.fcfx FC_Comp_Source_temp/FA_Source_P4_Dummy_Template.fcfx]
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_FA_Source_P4_Dummy_Template.fcfx FC_Comp_Source_FA_Source_P4_Dummy_Template.fcfx]


Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/FA_Source_P4_Dummy_Template.fcfx FC_Comp_Source_temp/FA_Source_P4_Dummy_Template.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_FA_Source_P4_Dummy_Template.fcfx FC_Comp_Source_FA_Source_P4_Dummy_Template.fcfx]


==Detailed description==
==Detailed description==
Line 91: Line 91:


{{Fcfile|FA_API_Sim_Demo.fcfx|FA API Sim Demo}}
{{Fcfile|FA_API_Sim_Demo.fcfx|FA API Sim Demo}}




Line 101: Line 105:


===AudioAddToBuffer===
===AudioAddToBuffer===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AudioAddToBuffer'''
| width="90%" class="mtx-class-macrohead" | '''AudioAddToBuffer'''
|-
|-
| colspan="2" | Writes a value to the 16-bit audio output buffer. 
| colspan="2" | Writes a value to the 16-bit audio output buffer. 
Line 120: Line 124:


===AudioQueueLength===
===AudioQueueLength===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AudioQueueLength'''
| width="90%" class="mtx-class-macrohead" | '''AudioQueueLength'''
|-
|-
| colspan="2" | Retreives the current length of valid data within the audio queue 
| colspan="2" | Retreives the current length of valid data within the audio queue 
Line 134: Line 138:


===AudioReadFromBuffer===
===AudioReadFromBuffer===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AudioReadFromBuffer'''
| width="90%" class="mtx-class-macrohead" | '''AudioReadFromBuffer'''
|-
|-
| colspan="2" | Allows the audio buffer to be used for other streaming data such as recording the mic.  
| colspan="2" | Allows the audio buffer to be used for other streaming data such as recording the mic.  
Line 148: Line 152:


===AudioStreamControl===
===AudioStreamControl===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AudioStreamControl'''
| width="90%" class="mtx-class-macrohead" | '''AudioStreamControl'''
|-
|-
| colspan="2" | Allows control of the audio output functionality via the onboard speaker. Data is loaded into the audio output buffer using the AddToBuffer function. 
| colspan="2" | Allows control of the audio output functionality via the onboard speaker. Data is loaded into the audio output buffer using the AddToBuffer function. 
Line 172: Line 176:


===BluetoothCheckConnection===
===BluetoothCheckConnection===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BluetoothCheckConnection'''
| width="90%" class="mtx-class-macrohead" | '''BluetoothCheckConnection'''
|-
|-
| colspan="2" | Checks the status of the Bluetooth connection. Returns 0 for not paired and 1 for paired. 
| colspan="2" | Checks the status of the Bluetooth connection. Returns 0 for not paired and 1 for paired. 
Line 186: Line 190:


===BluetoothQueueLength===
===BluetoothQueueLength===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BluetoothQueueLength'''
| width="90%" class="mtx-class-macrohead" | '''BluetoothQueueLength'''
|-
|-
| colspan="2" | Reads the length of received Bluetooth data in bytes.  
| colspan="2" | Reads the length of received Bluetooth data in bytes.  
Line 200: Line 204:


===BluetoothReceive===
===BluetoothReceive===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BluetoothReceive'''
| width="90%" class="mtx-class-macrohead" | '''BluetoothReceive'''
|-
|-
| colspan="2" | Attempt to read a byte from the Bluetooth receive queue. 
| colspan="2" | Attempt to read a byte from the Bluetooth receive queue. 
Line 214: Line 218:


===BluetoothTransmit===
===BluetoothTransmit===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BluetoothTransmit'''
| width="90%" class="mtx-class-macrohead" | '''BluetoothTransmit'''
|-
|-
| colspan="2" | Sends a byte via the Bluetooth data connection. 
| colspan="2" | Sends a byte via the Bluetooth data connection. 
Line 233: Line 237:


===BluetoothTransmitString===
===BluetoothTransmitString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BluetoothTransmitString'''
| width="90%" class="mtx-class-macrohead" | '''BluetoothTransmitString'''
|-
|-
| colspan="2" | Sends a string via the Bluetooth data connection. 
| colspan="2" | Sends a string via the Bluetooth data connection. 
Line 252: Line 256:


===CheckIR===
===CheckIR===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckIR'''
| width="90%" class="mtx-class-macrohead" | '''CheckIR'''
|-
|-
| colspan="2" | Checks to see if a IR sensor is within the master threshold distance. Returns 0 if the IR reading is below the threshold. Returns 1 if the IR reading is greater than or equal to the threshold. 
| colspan="2" | Checks to see if a IR sensor is within the master threshold distance. Returns 0 if the IR reading is below the threshold. Returns 1 if the IR reading is greater than or equal to the threshold. 
Line 271: Line 275:


===CheckLine===
===CheckLine===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckLine'''
| width="90%" class="mtx-class-macrohead" | '''CheckLine'''
|-
|-
| colspan="2" | Checks to see if a line sensor is within the master threshold distance. Returns 0 if the IR reading is below the threshold. Returns 1 if the IR reading is greater than or equal to the threshold. 
| colspan="2" | Checks to see if a line sensor is within the master threshold distance. Returns 0 if the IR reading is below the threshold. Returns 1 if the IR reading is greater than or equal to the threshold. 
Line 290: Line 294:


===CheckUSB===
===CheckUSB===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckUSB'''
| width="90%" class="mtx-class-macrohead" | '''CheckUSB'''
|-
|-
| colspan="2" | Checks to see if a USB cable is connected to the robot. Returns 0 for no connection and 1 for an active connection. 
| colspan="2" | Checks to see if a USB cable is connected to the robot. Returns 0 for no connection and 1 for an active connection. 
Line 304: Line 308:


===EncoderReadCount===
===EncoderReadCount===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EncoderReadCount'''
| width="90%" class="mtx-class-macrohead" | '''EncoderReadCount'''
|-
|-
| colspan="2" | Reads one of the motor encoder counters. Each encoder count is equal to 0.314159 mm.  
| colspan="2" | Reads one of the motor encoder counters. Each encoder count is equal to 0.314159 mm.  
Line 323: Line 327:


===EncoderReset===
===EncoderReset===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EncoderReset'''
| width="90%" class="mtx-class-macrohead" | '''EncoderReset'''
|-
|-
| colspan="2" | Resets the encoder counters to 0 
| colspan="2" | Resets the encoder counters to 0 
Line 337: Line 341:


===Forward===
===Forward===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Forward'''
| width="90%" class="mtx-class-macrohead" | '''Forward'''
|-
|-
| colspan="2" | Drives both motors of the formula flowcode forwards with the power specified.  
| colspan="2" | Drives both motors of the formula flowcode forwards with the power specified.  
Line 356: Line 360:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Starts up the Formula Allcode PWM for motor control and performs the wait for button press if enabled. 
| colspan="2" | Starts up the Formula Allcode PWM for motor control and performs the wait for button press if enabled. 
Line 370: Line 374:


===LCDBacklight===
===LCDBacklight===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDBacklight'''
| width="90%" class="mtx-class-macrohead" | '''LCDBacklight'''
|-
|-
| colspan="2" | Controls the brighness of the LCD backlight 
| colspan="2" | Controls the brighness of the LCD backlight 
Line 389: Line 393:


===LCDClear===
===LCDClear===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDClear'''
| width="90%" class="mtx-class-macrohead" | '''LCDClear'''
|-
|-
| colspan="2" | Clears the contents of the graphical LCD. 
| colspan="2" | Clears the contents of the graphical LCD. 
Line 403: Line 407:


===LCDDrawLine===
===LCDDrawLine===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDDrawLine'''
| width="90%" class="mtx-class-macrohead" | '''LCDDrawLine'''
|-
|-
| colspan="2" | Draws a line on the LCD. 
| colspan="2" | Draws a line on the LCD. 
Line 437: Line 441:


===LCDDrawRectangle===
===LCDDrawRectangle===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDDrawRectangle'''
| width="90%" class="mtx-class-macrohead" | '''LCDDrawRectangle'''
|-
|-
| colspan="2" | Draws a rectange on the LCD. 
| colspan="2" | Draws a rectange on the LCD. 
Line 481: Line 485:


===LCDPlotPixel===
===LCDPlotPixel===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDPlotPixel'''
| width="90%" class="mtx-class-macrohead" | '''LCDPlotPixel'''
|-
|-
| colspan="2" | Allows a single pixel on the LCD to be set or cleared. 
| colspan="2" | Allows a single pixel on the LCD to be set or cleared. 
Line 505: Line 509:


===LCDPrintNumber===
===LCDPrintNumber===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDPrintNumber'''
| width="90%" class="mtx-class-macrohead" | '''LCDPrintNumber'''
|-
|-
| colspan="2" | Prints a numeric value to the graphical LCD. 
| colspan="2" | Prints a numeric value to the graphical LCD. 
Line 539: Line 543:


===LCDPrintString===
===LCDPrintString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDPrintString'''
| width="90%" class="mtx-class-macrohead" | '''LCDPrintString'''
|-
|-
| colspan="2" | Prints a string to the graphical LCD. 
| colspan="2" | Prints a string to the graphical LCD. 
Line 573: Line 577:


===LCDSetBackgroundColour===
===LCDSetBackgroundColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDSetBackgroundColour'''
| width="90%" class="mtx-class-macrohead" | '''LCDSetBackgroundColour'''
|-
|-
| colspan="2" | Sets the pixel colour to drive the LCD. Default colour is 1 where a set pixel is black and the background is white. 
| colspan="2" | Sets the pixel colour to drive the LCD. Default colour is 1 where a set pixel is black and the background is white. 
Line 592: Line 596:


===LCDSetForegroundColour===
===LCDSetForegroundColour===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDSetForegroundColour'''
| width="90%" class="mtx-class-macrohead" | '''LCDSetForegroundColour'''
|-
|-
| colspan="2" | Sets the pixel colour to drive the LCD. Default colour is 1 where a set pixel is black and the background is white. 
| colspan="2" | Sets the pixel colour to drive the LCD. Default colour is 1 where a set pixel is black and the background is white. 
Line 611: Line 615:


===LCDWriteByte===
===LCDWriteByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LCDWriteByte'''
| width="90%" class="mtx-class-macrohead" | '''LCDWriteByte'''
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 640: Line 644:


===LEDOff===
===LEDOff===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LEDOff'''
| width="90%" class="mtx-class-macrohead" | '''LEDOff'''
|-
|-
| colspan="2" | Switches off a single LED on the front of the Formula Allcode.  
| colspan="2" | Switches off a single LED on the front of the Formula Allcode.  
Line 659: Line 663:


===LEDOn===
===LEDOn===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LEDOn'''
| width="90%" class="mtx-class-macrohead" | '''LEDOn'''
|-
|-
| colspan="2" | Switches on a single LED on the front of the Formula Allcode.  
| colspan="2" | Switches on a single LED on the front of the Formula Allcode.  
Line 678: Line 682:


===LEDWrite===
===LEDWrite===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LEDWrite'''
| width="90%" class="mtx-class-macrohead" | '''LEDWrite'''
|-
|-
| colspan="2" | Allows control of all 8-LEDs on the front of the Formula Allcode.  
| colspan="2" | Allows control of all 8-LEDs on the front of the Formula Allcode.  
Line 697: Line 701:


===LogoBackwards===
===LogoBackwards===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LogoBackwards'''
| width="90%" class="mtx-class-macrohead" | '''LogoBackwards'''
|-
|-
| colspan="2" | Drives the robot backward using the encoders as feedback to ensure the robot drives straight. Automatically stops at the specified distance. 
| colspan="2" | Drives the robot backward using the encoders as feedback to ensure the robot drives straight. Automatically stops at the specified distance. 
Line 716: Line 720:


===LogoForwards===
===LogoForwards===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LogoForwards'''
| width="90%" class="mtx-class-macrohead" | '''LogoForwards'''
|-
|-
| colspan="2" | Drives the robot forward using the encoders as feedback to ensure the robot drives straight. Automatically stops at the specified distance. 
| colspan="2" | Drives the robot forward using the encoders as feedback to ensure the robot drives straight. Automatically stops at the specified distance. 
Line 735: Line 739:


===LogoSetSpeed===
===LogoSetSpeed===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LogoSetSpeed'''
| width="90%" class="mtx-class-macrohead" | '''LogoSetSpeed'''
|-
|-
| colspan="2" | Sets the cruise speed for LOGO type macros. Default speed 20%. 
| colspan="2" | Sets the cruise speed for LOGO type macros. Default speed 20%. 
Line 754: Line 758:


===LogoTurnLeft===
===LogoTurnLeft===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LogoTurnLeft'''
| width="90%" class="mtx-class-macrohead" | '''LogoTurnLeft'''
|-
|-
| colspan="2" | Rotates the robot left by a specific angle using the encoders as feedback to ensure the robot turns evenly. Automatically stops at the specified turn angle. 
| colspan="2" | Rotates the robot left by a specific angle using the encoders as feedback to ensure the robot turns evenly. Automatically stops at the specified turn angle. 
Line 773: Line 777:


===LogoTurnRight===
===LogoTurnRight===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LogoTurnRight'''
| width="90%" class="mtx-class-macrohead" | '''LogoTurnRight'''
|-
|-
| colspan="2" | Rotates the robot right by a specific angle using the encoders as feedback to ensure the robot turns evenly. Automatically stops at the specified turn angle. 
| colspan="2" | Rotates the robot right by a specific angle using the encoders as feedback to ensure the robot turns evenly. Automatically stops at the specified turn angle. 
Line 792: Line 796:


===PlayNote===
===PlayNote===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PlayNote'''
| width="90%" class="mtx-class-macrohead" | '''PlayNote'''
|-
|-
| colspan="2" | Outputs a single tone from the onboard speaker for the period specified. 
| colspan="2" | Outputs a single tone from the onboard speaker for the period specified. 
Line 816: Line 820:


===ReadBattery===
===ReadBattery===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadBattery'''
| width="90%" class="mtx-class-macrohead" | '''ReadBattery'''
|-
|-
| colspan="2" | Reads the current voltage level from the LiPo battery. Return value is the battery voltage in Volts. Take care not to run the battery too low.  Voltages lower than 3.4V may damage the battery. 
| colspan="2" | Reads the current voltage level from the LiPo battery. Return value is the battery voltage in Volts. Take care not to run the battery too low.  Voltages lower than 3.4V may damage the battery. 
Line 830: Line 834:


===ReadIRSensor===
===ReadIRSensor===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadIRSensor'''
| width="90%" class="mtx-class-macrohead" | '''ReadIRSensor'''
|-
|-
| colspan="2" | Reads the analogue value from the specified IR distance sensor. Return value range: 0 to 4095 4095 represents the object is very close. 
| colspan="2" | Reads the analogue value from the specified IR distance sensor. Return value range: 0 to 4095 4095 represents the object is very close. 
Line 849: Line 853:


===ReadLDR===
===ReadLDR===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadLDR'''
| width="90%" class="mtx-class-macrohead" | '''ReadLDR'''
|-
|-
| colspan="2" | Reads the current light level from the on board light sensor. Return value range: 0 to 4095 4095 represents the maximum level of light and 0 represents the minimal level of light. 
| colspan="2" | Reads the current light level from the on board light sensor. Return value range: 0 to 4095 4095 represents the maximum level of light and 0 represents the minimal level of light. 
Line 863: Line 867:


===ReadLineSensor===
===ReadLineSensor===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadLineSensor'''
| width="90%" class="mtx-class-macrohead" | '''ReadLineSensor'''
|-
|-
| colspan="2" | Reads the analogue value from the specified IR line sensor. Return value range: 0 to 4095 4095 represents the object is reflecting the most light. 
| colspan="2" | Reads the analogue value from the specified IR line sensor. Return value range: 0 to 4095 4095 represents the object is reflecting the most light. 
Line 882: Line 886:


===ReadMic===
===ReadMic===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadMic'''
| width="90%" class="mtx-class-macrohead" | '''ReadMic'''
|-
|-
| colspan="2" | Reads the current audio signal level from the on-board microphone.  Return value range: 0 to 4095 
| colspan="2" | Reads the current audio signal level from the on-board microphone.  Return value range: 0 to 4095 
Line 896: Line 900:


===ReadSwitch===
===ReadSwitch===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadSwitch'''
| width="90%" class="mtx-class-macrohead" | '''ReadSwitch'''
|-
|-
| colspan="2" | Reads the value of one of the switches from the front of the Formula Allcode. 
| colspan="2" | Reads the value of one of the switches from the front of the Formula Allcode. 
Line 915: Line 919:


===Reverse===
===Reverse===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Reverse'''
| width="90%" class="mtx-class-macrohead" | '''Reverse'''
|-
|-
| colspan="2" | Drives both motors of the formula flowcode backwards with the power specified.  
| colspan="2" | Drives both motors of the formula flowcode backwards with the power specified.  
Line 934: Line 938:


===SetMotors===
===SetMotors===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetMotors'''
| width="90%" class="mtx-class-macrohead" | '''SetMotors'''
|-
|-
| colspan="2" | Sets the speed and direction of the Formula Allcode motors.  
| colspan="2" | Sets the speed and direction of the Formula Allcode motors.  
Line 958: Line 962:


===SpinLeft===
===SpinLeft===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SpinLeft'''
| width="90%" class="mtx-class-macrohead" | '''SpinLeft'''
|-
|-
| colspan="2" | Spins the formula flowcode on the spot in an anticlockwise direction as seen from above.  
| colspan="2" | Spins the formula flowcode on the spot in an anticlockwise direction as seen from above.  
Line 977: Line 981:


===SpinRight===
===SpinRight===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SpinRight'''
| width="90%" class="mtx-class-macrohead" | '''SpinRight'''
|-
|-
| colspan="2" | Spins the formula flowcode on the spot in a clockwise direction as seen from above.  
| colspan="2" | Spins the formula flowcode on the spot in a clockwise direction as seen from above.  
Line 996: Line 1,000:


===Stop===
===Stop===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Stop'''
| width="90%" class="mtx-class-macrohead" | '''Stop'''
|-
|-
| colspan="2" | Stops both motors. 
| colspan="2" | Stops both motors. 
Line 1,010: Line 1,014:


===WaitForSwitch===
===WaitForSwitch===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitForSwitch'''
| width="90%" class="mtx-class-macrohead" | '''WaitForSwitch'''
|-
|-
| colspan="2" | Waits for the specified switch to be pressed. 
| colspan="2" | Waits for the specified switch to be pressed. 
Line 1,026: Line 1,030:
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-
Line 1,058: Line 1,060:
| colspan="2" | Controls when the motor feedback is used. No - Speed control feedback is not used for SetMotors commands. Yes - Speed control feedback is used for the SetMotors commands. SetMotors commands include Forward, Backward, SpinLeft, SpinRight as well as SetMotors itself. Logo functions always use feedback. 
| colspan="2" | Controls when the motor feedback is used. No - Speed control feedback is not used for SetMotors commands. Yes - Speed control feedback is used for the SetMotors commands. SetMotors commands include Forward, Backward, SpinLeft, SpinRight as well as SetMotors itself. Logo functions always use feedback. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | IR Thresholds (CheckIR macro)
| width="90%" class="mtx-class-propfolder" | IR Thresholds (CheckIR macro)
|-
|-
|-
|-
Line 1,072: Line 1,074:
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation Properties
| width="90%" class="mtx-class-propfolder" | Simulation Properties
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 1.2
Category Mechatronics


Formula AllCode Dummy 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_Dummy_Template.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_FA_Source_P4_Dummy_Template.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.

FA-Line


Simulation with the API component

An example showing how to use the API component to drive the robot in simulation.

FA API Sim Demo






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

AudioStreamControl
Allows control of the audio output functionality via the onboard speaker. Data is loaded into the audio output buffer using the AddToBuffer function. 
- BYTE Mode
0=Off, 8=8-bit Mode, 16=16-bit Mode 
- BYTE SampleRate
Sets the sample rate 0=8KHz, 1=16KHz 
- VOID Return


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

CheckIR
Checks to see if a IR sensor is within the master threshold distance. Returns 0 if the IR reading is below the threshold. Returns 1 if the IR reading is greater than or equal to the threshold. 
- BYTE Sensor
Range: 0 to 7 - 0=Left, 1=Front Left, 2=Front, 3=Front Right, 4=Right, 5=Rear Right, 6=Rear, 7=Rear Left 
- BYTE Return


CheckLine

CheckLine
Checks to see if a line sensor is within the master threshold distance. Returns 0 if the IR reading is below the threshold. Returns 1 if the IR reading is greater than or equal to the threshold. 
- BYTE Sensor
Range: 0 to 1 - 0=Left, 1=Right 
- BYTE Return


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

LCDDrawRectangle
Draws a rectange on the LCD. 
- BYTE X1
Range 0-127 
- BYTE Y1
Range 0-31 
- BYTE X2
Range 0-127 
- BYTE Y2
Range 0-31 
- BYTE Transparent
Sets the transparency of the box, 0=Box contains background colour, 1=Box contains previous pixel data 
- BYTE Solid
Chooses to fill the box with colour, 0=Box contains transparency data, 1=Box contains foreground colour 
- VOID Return


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

LCDPrintNumber
Prints a numeric value to the graphical LCD. 
- BYTE X
The horizontal start pixel. Range 0-127 
- BYTE Y
Y coordinate to print the string. Range 0-31 
- UINT Number
 
- BYTE Transparent
 
- VOID Return


LCDPrintString

LCDPrintString
Prints a string to the graphical LCD. 
- BYTE X
The horizontal start pixel. Range 0-127 
- BYTE Y
Y coordinate to print the string. Range 0-31 
- STRING Data
 
- UINT Transparent
 
- VOID Return


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

LogoBackwards
Drives the robot backward using the encoders as feedback to ensure the robot drives straight. Automatically stops at the specified distance. 
- UINT Distance
Distance you want to robot to drive in mm. Range 1-65535 
- VOID Return


LogoForwards

LogoForwards
Drives the robot forward using the encoders as feedback to ensure the robot drives straight. Automatically stops at the specified distance. 
- UINT Distance
Distance you want to robot to drive in mm. Range 1-65535 
- VOID Return


LogoSetSpeed

LogoSetSpeed
Sets the cruise speed for LOGO type macros. Default speed 20%. 
- BYTE Speed
Range 1-100, Default 60 
- VOID Return


LogoTurnLeft

LogoTurnLeft
Rotates the robot left by a specific angle using the encoders as feedback to ensure the robot turns evenly. Automatically stops at the specified turn angle. 
- UINT Angle
Angle in degrees you wish to rotate. Range 1-65536 
- VOID Return


LogoTurnRight

LogoTurnRight
Rotates the robot right by a specific angle using the encoders as feedback to ensure the robot turns evenly. Automatically stops at the specified turn angle. 
- UINT Angle
Angle in degrees you wish to rotate. Range 1-65536 
- VOID Return


PlayNote

PlayNote
Outputs a single tone from the onboard speaker for the period specified. 
- UINT Note
Sets the pitch of the note in Hz. Range: 1 - 10000 
- UINT Time
Time period to play the note for in milliseconds. Range: 0 - 65535 ms 
- VOID Return


ReadBattery

ReadBattery
Reads the current voltage level from the LiPo battery. Return value is the battery voltage in Volts. Take care not to run the battery too low. Voltages lower than 3.4V may damage the battery. 
- FLOAT Return


ReadIRSensor

ReadIRSensor
Reads the analogue value from the specified IR distance sensor. Return value range: 0 to 4095 4095 represents the object is very close. 
- BYTE Channel
Range: 0 to 7 - 0=Left, 1=Front Left, 2=Front, 3=Front Right, 4=Right, 5=Rear Right, 6=Rear, 7=Rear Left 
- UINT Return


ReadLDR

ReadLDR
Reads the current light level from the on board light sensor. Return value range: 0 to 4095 4095 represents the maximum level of light and 0 represents the minimal level of light. 
- UINT Return


ReadLineSensor

ReadLineSensor
Reads the analogue value from the specified IR line sensor. Return value range: 0 to 4095 4095 represents the object is reflecting the most light. 
- BYTE Channel
Range: 0 to 1 - 0=Left, 1=Right 
- UINT Return


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


Property reference

Properties
Wait For Button
Determines if the program will automatically wait for one of the front switches to be pressed before executing the program. Ran as part of the initialise function after the various components have been initialised. 
Show Creation Info
Specifies what information is shown to the user on calling the initialise function. The time and date shown are the compilation time and date to help pinpoint the firmware version. 
Bluetooth Reset
Decides if the Bluetooth data connection can reset the Formula AllCode. Used by mLoader when programming via Bluetooth to allow reprogramming without having to physically touch the robot. To ensure programming security set this option to No. 
Use Motor Feedback
Controls when the motor feedback is used. No - Speed control feedback is not used for SetMotors commands. Yes - Speed control feedback is used for the SetMotors commands. SetMotors commands include Forward, Backward, SpinLeft, SpinRight as well as SetMotors itself. Logo functions always use feedback. 
IR Thresholds (CheckIR macro)
IR Distance
IR Threshold used with the CheckIR macro 
Line Sensitivity
 
Simulation Properties
Sim Speed (1 - 100)
Sets the simulated amount of movement relative to the speed of the Formula Allcode. 
Timer Interval (ms)
Interval in milliseconds between each simulated movement of the Formula Allcode robot. 
Collision Method
Select which objects the robot sensors will interact with. 
Light Source
Panel object specified as the simulation light source. Used when simulating "find the light" type tasks.