Difference between revisions of "Exercise - Using Analogue Input Devices"
From Flowcode Help
Jump to navigationJump to searchJohnVerrill (talk | contribs) |
JohnVerrill (talk | contribs) |
||
Line 8: | Line 8: | ||
As a result, it is more difficult to handle in Flowcode. | As a result, it is more difficult to handle in Flowcode. | ||
A component macro [[File:Btn Component Macro.gif|30px]] is used to input data from an analogue sensor. | A component macro [[File:Btn Component Macro.gif|30px]] is used to input data from an analogue sensor. | ||
+ | |||
+ | |||
+ | |||
+ | ===Initialise the LCD=== | ||
+ | * Click and drag an infinite loop between the 'BEGIN' and 'END' icons. | ||
+ | * Inside the loop: | ||
+ | :* Click and drag a 'Component macro' icon.[[File:Btn_Component_Macro.gif|30px]] | ||
+ | ::* Double click on it to open the dialogue box, so that you can configure it. | ||
+ | ::: The program 'knows' which components you have added to the System or Dashboard panel, and modifies the list of available commands accordingly. | ||
+ | ::: Under 'Components', the ADC dial will be listed, and underneath it the list of commands. | ||
+ | ::* Scroll down the list and click on the 'GetByte' command. | ||
+ | ::: This reads the output of the analogue input device - the ADC dial in this case, and stores it in the byte variable 'input'. | ||
+ | ::* Rename the 'Display name' as "Read the input". | ||
+ | ::* Click on 'OK'. | ||
+ | ::* The dialogue box is shown below. |
Revision as of 19:35, 24 June 2013
The aim of this exercise is to use analogue input devices within a Flowcode flowchart.
Digital inputs are simpler to deal with, as they have a finite range of possible values.
For example, a two bit digital input can have one of only four possible values - 00, 01, 10 or 11.
Flowcode uses an 'Input' icon to deal with digital inputs.
An analogue input, on the other hand can have any of an infinite number of possible values.
As a result, it is more difficult to handle in Flowcode.
A component macro is used to input data from an analogue sensor.
Initialise the LCD
- Click and drag an infinite loop between the 'BEGIN' and 'END' icons.
- Inside the loop:
-
- Double click on it to open the dialogue box, so that you can configure it.
- The program 'knows' which components you have added to the System or Dashboard panel, and modifies the list of available commands accordingly.
- Under 'Components', the ADC dial will be listed, and underneath it the list of commands.
- Scroll down the list and click on the 'GetByte' command.
- This reads the output of the analogue input device - the ADC dial in this case, and stores it in the byte variable 'input'.
- Rename the 'Display name' as "Read the input".
- Click on 'OK'.
- The dialogue box is shown below.