Difference between revisions of "Exercise - Expanding a Program"

From Flowcode Help
Jump to navigationJump to search
Line 24: Line 24:
  
 
First, we are going to add two more LED components:
 
First, we are going to add two more LED components:
* Either copy and paste the current component on the System Panel to duplicate the component
+
* Either copy and paste the current component on the System Panel to duplicate the component.
* Or add two more components by using the [[Tools and Views#2) Components Toolbar|Components Toolbar]]
+
* Or add two more components by using the [[Tools and Views#2) Components Toolbar|Components Toolbar]].
  
  
Line 34: Line 34:
 
Next change the colour and connection properties of the two new LEDs.
 
Next change the colour and connection properties of the two new LEDs.
 
* Change the middle LED properties.
 
* Change the middle LED properties.
:* Connect the LED to Port B Pin 1 by changing the 'Connection' property to '$PORTB.1'
+
:* Connect the LED to Port B Pin 1 by changing the 'Connection' property to '$PORTB.1'.
 
:* Then change the 'Color' property to yellow (00FFFF) using the colour selection window.
 
:* Then change the 'Color' property to yellow (00FFFF) using the colour selection window.
  

Revision as of 08:26, 23 July 2013

<sidebar>Sidebar: Taking Flowcode Further</sidebar> This exercise assumes you have created, tested and documented the program described in the exercise Documenting a Flowchart.

Because you have documented the flowchart properly, you can easily and accurately change the program as you know exactly how the program functions and what process it goes through.



Load the Flowcode flowchart


Enhancing programs

Now that you have a fully functioning program which is properly documented both by display names of icons and detailed comments, you can manipulate this program integrate it into another system, or expand the program further and turn it into your own expanded system, and even turn it into a full application.

You do not have to massively expand your program to make it more effective, sometimes a little change can make a big difference, adding as little as one component can change the program to be completely suitable for use elsewhere.


Expand your program

We are going to expand our program to function as a set of traffic lights, to do this we are going to add 2 more LEDs and add to our 'Decision' icon which responds to when the switch is on to activate the traffic lights accordingly.


First, we are going to add two more LED components:

  • Either copy and paste the current component on the System Panel to duplicate the component.
  • Or add two more components by using the Components Toolbar.


Now position the LEDs accordingly on the System Panel.

  • Move the existing connected LED to the bottom and align the new two LEDs above it.


Next change the colour and connection properties of the two new LEDs.

  • Change the middle LED properties.
  • Connect the LED to Port B Pin 1 by changing the 'Connection' property to '$PORTB.1'.
  • Then change the 'Color' property to yellow (00FFFF) using the colour selection window.


What Next?

Now you have effectively developed and expanded a program you can move on to other exercises and learn different areas, methods and techniques.

The next exercise available will show you how create an effective program using Component Macros and how to expand the program using Component Macros to increase efficiency. (See Exercise - Using Component Macros)