Difference between revisions of "Component: Formula Flowcode (Mechatronics)"
(XML import) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | |||
{| width="50%" | {| width="50%" | ||
|- | |- | ||
Line 5: | Line 7: | ||
|- | |- | ||
| width="20%" style="color: gray;" | Version | | width="20%" style="color: gray;" | Version | ||
− | | 1. | + | | 1.6 (Release) |
|- | |- | ||
| width="20%" style="color: gray;" | Category | | width="20%" style="color: gray;" | Category | ||
Line 18: | Line 20: | ||
==Examples== | ==Examples== | ||
+ | ===Importing from v5=== | ||
+ | |||
+ | The Formula Flowcode component in Flowcode v6 has a new Initialise macro which will need to be added to your program before any other calls to the component are made. | ||
+ | |||
===Line Following=== | ===Line Following=== | ||
Line following example using the Formula Flowcode, works with objects on the simulation panel and on the real hardware. | Line following example using the Formula Flowcode, works with objects on the simulation panel and on the real hardware. | ||
− | |||
{{Fcfile|FF-Line.fcfx|FF-Line}} | {{Fcfile|FF-Line.fcfx|FF-Line}} | ||
− | |||
[[File:FFLine.jpg]] | [[File:FFLine.jpg]] | ||
Line 30: | Line 34: | ||
Wall following example using the Formula Flowcode, works with a randomly generated maze on the simulation panel and on the real hardware. | Wall following example using the Formula Flowcode, works with a randomly generated maze on the simulation panel and on the real hardware. | ||
− | |||
{{Fcfile|FF-Maze.fcfx|FF-Maze}} | {{Fcfile|FF-Maze.fcfx|FF-Maze}} | ||
− | |||
[[File:Print3.jpg]] | [[File:Print3.jpg]] | ||
Line 201: | Line 203: | ||
:[[Variable Types|INT]] ''Left_Power'' | :[[Variable Types|INT]] ''Left_Power'' | ||
+ | ::Valid Range = -255 to 255 | ||
:[[Variable Types|INT]] ''Right_Power'' | :[[Variable Types|INT]] ''Right_Power'' | ||
+ | ::Valid Range = -255 to 255 | ||
Line 359: | Line 363: | ||
Sets whether the sensors on the formula flowcode interact with everything on the panel or just a specific group. | Sets whether the sensors on the formula flowcode interact with everything on the panel or just a specific group. | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Light Source</u></span> | ||
+ | |||
+ | This property is of type ''Panel object'' and can be referenced with the variable name ''LightSource''. | ||
+ | |||
+ | Panel object specified as the simulation light source when doing light finding tasks | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Audio Source</u></span> | ||
+ | |||
+ | This property is of type ''Panel object'' and can be referenced with the variable name ''AudioSource''. | ||
+ | |||
+ | Panel object specified as the simulation light source when doing light finding tasks |
Latest revision as of 17:59, 18 March 2016
Author | Matrix Ltd |
Version | 1.6 (Release) |
Category | Mechatronics |
Contents
Formula Flowcode component
A component to allow all the features of the Formula Flowcode robot to be investigated. Fully simulated component which can interact with simulated objects on the panel as well as control the real hardware.
Examples
Importing from v5
The Formula Flowcode component in Flowcode v6 has a new Initialise macro which will need to be added to your program before any other calls to the component are made.
Line Following
Line following example using the Formula Flowcode, works with objects on the simulation panel and on the real hardware.
FF-Line
Maze Solving
Wall following example using the Formula Flowcode, works with a randomly generated maze on the simulation panel and on the real hardware.
FF-Maze
Downloadable macro reference
PlayNote
Outputs a single tone from the onboard speaker for the period specified
Parameters
- BYTE Note
- UINT Delay_ms
Return value
- This call does not return a value
LEDOn
Switches on a single LED on the front of the Formula Flowcode.
Parameters
- BYTE LED
Return value
- This call does not return a value
Stop
Stops both motors
Parameters
- This macro has no parameters
Return value
- This call does not return a value
LEDOff
Switches off a single LED on the front of the Formula Flowcode.
Parameters
- BYTE LED
Return value
- This call does not return a value
ReadMic
Reads the current audio signal level from the on-board microphone.
Parameters
- This macro has no parameters
Return value
ReadSwitch
Reads the value of one of the switches from the front of the Formula Flowcode.
Parameters
- BYTE Switch
Return value
SpinLeft
Spins the formula flowcode on the spot in an anticlockwise direction as seen from above.
Parameters
- BYTE Power
Return value
- This call does not return a value
Forward
Drives both motors of the formula flowcode forwards with the power specified.
Parameters
- BYTE Power
Return value
- This call does not return a value
ReadLineSensor
Returns the digital value from the line sensor specified.
Parameters
- BYTE Sensor
Return value
SpinRight
Spins the formula flowcode on the spot in a clockwise direction as seen from above.
Parameters
- BYTE Power
Return value
- This call does not return a value
CheckIR
Checks to see if a IR sensor is within the master threshold distance.
Parameters
- BYTE Sensor
Return value
ReadIRSensor
Reads the analogue value from the specified IR distance sensor.
Parameters
- BYTE Sensor
Return value
SetMotors
Sets the speed and direction of the Formula Flowcode motors.
Parameters
- INT Left_Power
- Valid Range = -255 to 255
- INT Right_Power
- Valid Range = -255 to 255
Return value
- This call does not return a value
Reverse
Drives both motors of the formula flowcode backwards with the power specified.
Parameters
- BYTE Power
Return value
- This call does not return a value
WaitForSwitch
Waits for the specified switch to be pressed.
Parameters
- BYTE Switch
Return value
- This call does not return a value
ReadLDR
Reads the current audio signal level from the on-board light sensor.
Parameters
- This macro has no parameters
Return value
WriteLEDs
Allows control of all 8-LEDs on the front of the Formula Flowcode.
Parameters
- BYTE LED_Byte
Return value
- This call does not return a value
Initialise
Starts up the formula flowcode PWM for motor control and performs the wait for button press
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Wait For Button
This property is of type True or false and can be referenced with the variable name wait_b4_start.
Determines if the program will automatically wait for one of the front switches to be pressed before executing the program.
IR Sensitivity
This property is of type Fixed list of ints and can be referenced with the variable name ret_type.
InfraRed read mode - 8-bit or 10-bit
Motor Balance (-100 - 100)
This property is of type Signed integer and can be referenced with the variable name balance.
Motor balance, way of modifying the relative speeds of the motors to allow mismatched motors to work together better.
Left
This property is of type Signed integer and can be referenced with the variable name thresh_left.
IR Threshold used with the CheckIR macro
Front
This property is of type Signed integer and can be referenced with the variable name thresh_front.
IR Threshold used with the CheckIR macro
Right
This property is of type Signed integer and can be referenced with the variable name thresh_right.
IR Threshold used with the CheckIR macro
Sim Speed (1 - 100)
This property is of type Signed integer and can be referenced with the variable name sim_speed.
Sets the simulated amount of movement relative to the speed of the formula flowcode
Smooth Animation
This property is of type True or false and can be referenced with the variable name Animate_Style.
Selects if the simulation has additional smoothing going on in between iterations
Manual Redraw
This property is of type True or false and can be referenced with the variable name Redraw.
Sets if the animation forces it's own redraws or waits for the system to perform a redraw
Timer Interval (ms)
This property is of type Signed integer and can be referenced with the variable name timer_interval.
Interval in ms between each iteration of the formula flowcode simulated movement
IR Sensor Iterations
This property is of type Signed integer and can be referenced with the variable name IR_Count.
Number of times to repeat the IR sensor tests and therefore how far the simulated IR sensors can sense.
IR Sensor Resolution
This property is of type Floating point and can be referenced with the variable name IR_Res.
The amount of distance to travel for each iteration of the IR sensor
Collision Method
This property is of type Fixed list of ints and can be referenced with the variable name collision_mode.
Sets whether the sensors on the formula flowcode interact with everything on the panel or just a specific group.
Light Source
This property is of type Panel object and can be referenced with the variable name LightSource.
Panel object specified as the simulation light source when doing light finding tasks
Audio Source
This property is of type Panel object and can be referenced with the variable name AudioSource.
Panel object specified as the simulation light source when doing light finding tasks