|
|
| (67 intermediate revisions by 5 users not shown) |
| Line 1: |
Line 1: |
| Component macros are sections of code that have been written to support the components included with Flowcode 6.<br />
| | For an excellent introduction guide, we recommend [https://www.flowcode.co.uk/education/ Introduction to microcontroller programming] |
| They take all the effort out of using these components.
| |
| This exercise uses them to control a particularly complicated, but very common device, the Liquid Crystal Display (LCD).
| |
| It uses it to display the elapsed time.
| |
| | |
| | |
| __TOC__
| |
| | |
| ==The core sequence==
| |
| The flowchart sequence for the elapsed time will be:
| |
| : Check if the switch is pressed.
| |
| :: If it isn't, go back to the beginning.
| |
| :: If it is:
| |
| ::: initialize the LCD;
| |
| ::: display the text "Elapsed time";
| |
| ::: initialize the time;
| |
| ::: display the time
| |
| ::: wait for one second;
| |
| ::: increment the time;
| |
| ::: display the new time;
| |
| ::: loop back and repeat this process.
| |
| | |
| | |
| ==Set up the flowchart==
| |
| * Open Flowcode, and set up the new flowchart as described in [[Exercise - Creating Your First Flowchart|Creating Your First Flowchart]].
| |
| | |
| | |
| ==Create the core sequence==
| |
| * Locate the 'LCD' inside the 'Outputs' toolbox.
| |
| :* Hover over the image to the left of the 'LCD' label, and click on the down-arrow that appears. | |
| :* Click on the 'Add to system panel' option to select it.
| |
| :* Zoom in until the LCD image is big enough to read.
| |
| * Click and drag an infinite loop between the 'BEGIN' and 'END' icons.
| |
| * Inside the loop:
| |
| :* Click and drag a 'Component macro' icon.
| |
| | |
| The program 'knows' when you have added a component to the System or Dashboard panel.
| |
For an excellent introduction guide, we recommend Introduction to microcontroller programming