Difference between revisions of "Exercise - Using Component Macros"

From Flowcode Help
Jump to navigationJump to search
Line 2: Line 2:
 
They take all the effort out of using these components.
 
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).
 
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, once a switch has been pressed
+
It uses it to display the elapsed time.
  
  
 
__TOC__
 
__TOC__
  
==Formulate the sequence==
+
==The core sequence==
The flowchart sequence will be:
+
The flowchart sequence for the elapsed time will be:
 
: Check if the switch is pressed.
 
: Check if the switch is pressed.
 
:: If it isn't, go back to the beginning.
 
:: If it isn't, go back to the beginning.
 
:: If it is:
 
:: If it is:
::: switch on the lamp;
+
::: initialize the LCD;
::: wait for 10 seconds;
+
::: display the text "Elapsed time";
::: switch off the lamp;
+
::: initialize the time;
::: go back to the beginning.
+
::: display the time
 
+
::: wait for one second;
It takes such a short time for the microcontroller to carry this out, that we don't need to worry whether the switch latches on or not.
+
::: increment the time;
 +
::: display the new time;
 +
::: loop back and repeat this process.
  
  

Revision as of 14:43, 20 June 2013

Component macros are sections of code that have been written to support the components included with Flowcode 6.
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.


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

Gen Startup Selection.png


The program 'knows' when you have added a component to the System or Dashboard panel.