Component: Formula Flowcode (Mechatronics)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 2.0 (Release)
Category Mechatronics


Image 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. FC6 Icon.png FF-Line FFLine.jpg


Maze Solving

Wall following example using the Formula Flowcode, works with a randomly generated maze on the simulation panel and on the real hardware. FC6 Icon.png FF-Maze Print3.jpg

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

INT


ReadSwitch

Reads the value of one of the switches from the front of the Formula Flowcode.

Parameters

BYTE Switch


Return value

BYTE


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

BYTE


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

BYTE


ReadIRSensor

Reads the analogue value from the specified IR distance sensor.

Parameters

BYTE Sensor


Return value

UINT


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

INT


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.