Component: Formula AllCode Dummy (RB4420) (Mechatronics): Difference between revisions
Appearance
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 108: | Line 108: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 127: | Line 127: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 141: | Line 141: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 155: | Line 155: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 179: | Line 179: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 193: | Line 193: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 207: | Line 207: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 221: | Line 221: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 240: | Line 240: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 259: | Line 259: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 278: | Line 278: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 297: | Line 297: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 311: | Line 311: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 330: | Line 330: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''EncoderReset''' | ||
|- | |- | ||
| colspan="2" | Resets the encoder counters to 0 | | colspan="2" | Resets the encoder counters to 0 | ||
| Line 344: | Line 344: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 363: | Line 363: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 377: | Line 377: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 396: | Line 396: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 410: | Line 410: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''LCDDrawLine''' | ||
|- | |- | ||
| colspan="2" | Draws a line on the LCD. | | colspan="2" | Draws a line on the LCD. | ||
| Line 444: | Line 444: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''LCDDrawRectangle''' | ||
|- | |- | ||
| colspan="2" | Draws a rectange on the LCD. | | colspan="2" | Draws a rectange on the LCD. | ||
| Line 488: | Line 488: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 512: | Line 512: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 546: | Line 546: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 580: | Line 580: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 599: | Line 599: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 618: | Line 618: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''LCDWriteByte''' | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
| Line 647: | Line 647: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 666: | Line 666: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 685: | Line 685: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 704: | Line 704: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 723: | Line 723: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 742: | Line 742: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 761: | Line 761: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 780: | Line 780: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 799: | Line 799: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 823: | Line 823: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 837: | Line 837: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 856: | Line 856: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 870: | Line 870: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 889: | Line 889: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 903: | Line 903: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 922: | Line 922: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 941: | Line 941: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 965: | Line 965: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 984: | Line 984: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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 1,003: | Line 1,003: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Stop''' | ||
|- | |- | ||
| colspan="2" | Stops both motors. | | colspan="2" | Stops both motors. | ||
| Line 1,017: | Line 1,017: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | 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,036: | Line 1,036: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| Line 1,060: | 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" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | IR Thresholds (CheckIR macro) | ||
|- | |- | ||
|- | |- | ||
| Line 1,074: | Line 1,074: | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | 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.
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. | |
| Data | |
| Return | |
AudioQueueLength
| AudioQueueLength | |
| Retreives the current length of valid data within the audio queue | |
| Return | |
AudioReadFromBuffer
| AudioReadFromBuffer | |
| Allows the audio buffer to be used for other streaming data such as recording the mic. | |
| Return | |
AudioStreamControl
BluetoothCheckConnection
| BluetoothCheckConnection | |
| Checks the status of the Bluetooth connection. Returns 0 for not paired and 1 for paired. | |
| Return | |
BluetoothQueueLength
| BluetoothQueueLength | |
| Reads the length of received Bluetooth data in bytes. | |
| Return | |
BluetoothReceive
| BluetoothReceive | |
| Attempt to read a byte from the Bluetooth receive queue. | |
| Return | |
BluetoothTransmit
| BluetoothTransmit | |
| Sends a byte via the Bluetooth data connection. | |
| Data | |
| Return | |
BluetoothTransmitString
| BluetoothTransmitString | |
| Sends a string via the Bluetooth data connection. | |
| Data | |
| 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. | |
| Return | |
EncoderReadCount
| EncoderReadCount | |
| Reads one of the motor encoder counters. Each encoder count is equal to 0.314159 mm. | |
| Channel | |
| 0 = LeftCount, 1=RightCount | |
| Return | |
EncoderReset
| EncoderReset | |
| Resets the encoder counters to 0 | |
| Return | |
Forward
| Forward | |
| Drives both motors of the formula flowcode forwards with the power specified. | |
| Power | |
| Amount of power to use to drive motor. Range 0-100 | |
| Return | |
Initialise
| Initialise | |
| Starts up the Formula Allcode PWM for motor control and performs the wait for button press if enabled. | |
| Return | |
LCDBacklight
| LCDBacklight | |
| Controls the brighness of the LCD backlight | |
| Brightness | |
| Range: 0-100, 0=Off, 1=Min Brightness, 100=Max Brightness | |
| Return | |
LCDClear
| LCDClear | |
| Clears the contents of the graphical LCD. | |
| Return | |
LCDDrawLine
| LCDDrawLine | |
| Draws a line on the LCD. | |
| X1 | |
| Range 0-127 | |
| Y1 | |
| Range 0-31 | |
| X2 | |
| Range 0-127 | |
| Y2 | |
| Range 0-31 | |
| Return | |
LCDDrawRectangle
LCDPlotPixel
| LCDPlotPixel | |
| Allows a single pixel on the LCD to be set or cleared. | |
| X | |
| Sets the X coordinate - Range 0-127 | |
| Y | |
| Sets the Y coordinate - Range 0-31 | |
| 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. | |
| Colour | |
| Range 0-1 : 0=White, 1=Black | |
| 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. | |
| Colour | |
| Range 0-1 : 0=White, 1=Black | |
| Return | |
LCDWriteByte
| LCDWriteByte | |
| Data | |
| X | |
| Y | |
| Return | |
LEDOff
| LEDOff | |
| Switches off a single LED on the front of the Formula Allcode. | |
| LED | |
| Which LED to switch on, range 0-7 | |
| Return | |
LEDOn
| LEDOn | |
| Switches on a single LED on the front of the Formula Allcode. | |
| LED | |
| Which LED to switch on, range 0-7 | |
| Return | |
LEDWrite
| LEDWrite | |
| Allows control of all 8-LEDs on the front of the Formula Allcode. | |
| LED_Byte | |
| 8-bit binary value to write to the 8 LEDs | |
| Return | |
LogoBackwards
LogoForwards
LogoSetSpeed
| LogoSetSpeed | |
| Sets the cruise speed for LOGO type macros. Default speed 20%. | |
| Speed | |
| Range 1-100, Default 60 | |
| 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 | |
| Return | |
ReadSwitch
| ReadSwitch | |
| Reads the value of one of the switches from the front of the Formula Allcode. | |
| Switch | |
| Which switch do we want to read 0=Left, 1=Right | |
| Return | |
Reverse
| Reverse | |
| Drives both motors of the formula flowcode backwards with the power specified. | |
| Power | |
| Amount of power to use to drive motor. Range 0-100 | |
| Return | |
SetMotors
| SetMotors | |
| Sets the speed and direction of the Formula Allcode motors. | |
| Left | |
| Valid Range = -100 to 100 | |
| Right | |
| Valid Range = -100 to 100 | |
| Return | |
SpinLeft
| SpinLeft | |
| Spins the formula flowcode on the spot in an anticlockwise direction as seen from above. | |
| Power | |
| Amount of power to use to drive motor. Range 0-100 | |
| Return | |
SpinRight
| SpinRight | |
| Spins the formula flowcode on the spot in a clockwise direction as seen from above. | |
| Power | |
| Amount of power to use to drive motor. Range 0-100 | |
| Return | |
Stop
| Stop | |
| Stops both motors. | |
| Return | |
WaitForSwitch
| WaitForSwitch | |
| Waits for the specified switch to be pressed. | |
| Switch | |
| Which switch do we want to wait for 0=Left, 1=Right, 2=Either, 3=Both | |
| Return | |
