Difference between revisions of "Exercise - Adding Devices to a Program"

From Flowcode Help
Jump to navigationJump to search
Line 7: Line 7:
  
 
==Load the Flowcode Flowchart==
 
==Load the Flowcode Flowchart==
[[File:gen_exerciseFirstFlowchartadddev_switchprops_01.png|300px|right]]
+
 
 
* Open the flowchart, called 'Lamp1.fcf' which you created in the exercise [[Exercise - Creating Your First Flowchart|Creating Your First Flowchart]].
 
* Open the flowchart, called 'Lamp1.fcf' which you created in the exercise [[Exercise - Creating Your First Flowchart|Creating Your First Flowchart]].
 
:(For help with this, see the exercise [[Exercise - Opening an Existing Flowchart|Opening an Existing Flowchart]])
 
:(For help with this, see the exercise [[Exercise - Opening an Existing Flowchart|Opening an Existing Flowchart]])
Line 13: Line 13:
  
  
==Add the switch==
+
==Add the Switch==
 +
[[File:gen_exerciseFirstFlowchartadddev_switchprops_01.png|300px|right]]
 
* Click on the 'Inputs' toolbox, and locate the 'Push Round Panel' switch.
 
* Click on the 'Inputs' toolbox, and locate the 'Push Round Panel' switch.
 
* Hover over the image, and click on the down arrow that appears.
 
* Hover over the image, and click on the down arrow that appears.
 
* Select the 'Add to system panel' option.
 
* Select the 'Add to system panel' option.
 +
 +
 
* Click on the switch on the [[System Panel]] to select it. Its properties appear in the Panel Properties.
 
* Click on the switch on the [[System Panel]] to select it. Its properties appear in the Panel Properties.
 +
: Notice that the name ('Handle') of the component selected appears at the top of the Panel Properties.
 +
: In this case, it shows the name of the switch as 'sw_push_rnd_pnl'!
 +
 +
 
* Find the 'Connections' properties on the Panel Properties, and click on the 'Unconnected' label.
 
* Find the 'Connections' properties on the Panel Properties, and click on the 'Unconnected' label.
: A pinout of the microcontroller appears.
+
: A pinout of the microcontroller appears.  
 
:* Click on the rectangle representing the pin for Port A bit 0 (called RA0/AN0 on the graphic.
 
:* Click on the rectangle representing the pin for Port A bit 0 (called RA0/AN0 on the graphic.
 
:: This connects the switch to Port A bit 0 of the microcontroller, matching the settings you used when you created the flowchart.
 
:: This connects the switch to Port A bit 0 of the microcontroller, matching the settings you used when you created the flowchart.
 
:: This setting is shown opposite.
 
:: This setting is shown opposite.
 +
 +
:* No other properties need changing, though'World size'(which may appear as 'Scale') allows you to change the size (and shape) of the switch if you wish.
 +
 +
 +
 +
 +
 +
 +
==Add the Lamp==
 +
* Click on the 'Outputs' toolbox, and locate the 'Single LED', which we will use as a lamp..
 +
* Hover over the image, and click on the down arrow that appears.
 +
* Select the 'Add to system panel' option.
 +
* The LED appears in the middle of the System Panel, probably right on top of the switch.
 +
: It should already be selected, but if not click on it.
 +
: If so, drag it to a suitable position off to one side

Revision as of 19:34, 12 June 2013

This exercise assumes that you have already built the Flowcode flowchart described in the exercise Creating Your First Flowchart.
To complete the program, you need to add the two electronic components, the switch and the lamp.



Load the Flowcode Flowchart

(For help with this, see the exercise Opening an Existing Flowchart)
The System Panel and Panel Properties should be visible. If not, use the View menu to select them.


Add the Switch

  • Click on the 'Inputs' toolbox, and locate the 'Push Round Panel' switch.
  • Hover over the image, and click on the down arrow that appears.
  • Select the 'Add to system panel' option.


  • Click on the switch on the System Panel to select it. Its properties appear in the Panel Properties.
Notice that the name ('Handle') of the component selected appears at the top of the Panel Properties.
In this case, it shows the name of the switch as 'sw_push_rnd_pnl'!


  • Find the 'Connections' properties on the Panel Properties, and click on the 'Unconnected' label.
A pinout of the microcontroller appears.
  • Click on the rectangle representing the pin for Port A bit 0 (called RA0/AN0 on the graphic.
This connects the switch to Port A bit 0 of the microcontroller, matching the settings you used when you created the flowchart.
This setting is shown opposite.
  • No other properties need changing, though'World size'(which may appear as 'Scale') allows you to change the size (and shape) of the switch if you wish.




Add the Lamp

  • Click on the 'Outputs' toolbox, and locate the 'Single LED', which we will use as a lamp..
  • Hover over the image, and click on the down arrow that appears.
  • Select the 'Add to system panel' option.
  • The LED appears in the middle of the System Panel, probably right on top of the switch.
It should already be selected, but if not click on it.
If so, drag it to a suitable position off to one side