Difference between revisions of "Exercise - Testing an Imported LED Component"

From Flowcode Help
Jump to navigationJump to search
(Created page with "300px|right * Create a new flowchart. * The following assumes that you have imported a LED component, as described in [[Ex...")
 
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:gen_exerciseimportmacro_compmacroprops.png|300px|right]]
+
<sidebar>Sidebar: Flowcode Exercises:Ex3</sidebar>
* Create a new flowchart.
+
* [[Creating Flowcharts|Create a new Flowcode flowchart]].
  
* The following assumes that you have imported a LED component, as described in [[Exercise - Importinga LED component]].
+
* The following assumes that you have imported a LED component, as described in [[Exercise - Importing the LED Component]].
  
 +
* Build the flowchart as follows:
 +
::* Open the 'Outputs' toolbox, where you stored the exported 'newLED' component.
  
 +
::* Locate the 'newLED' component, and use the down-arrow next to it to add it to the [[System Panel]].
  
 +
::* Drag and drop a 'Loop' icon onto the flowchart. Leave it in its default state, to loop indefinitely.
  
 +
::* Drag and drop a 'Component macro' icon inside the loop.
  
 +
::* Double-click on it so that you can configure it.
  
 +
::* Click on the 'Simulation' tab to see the associated macros. You should see two, called 'LEDoff' and 'LEDon'.
  
 +
::* Click on the 'LEDon' macro. Change the 'Display name' to "Switch on" and click 'OK'.
  
* Open the 'Outputs' toolbox, where you stored the exported 'newLED' component. (If no destination was specified for the exported component, it would appear in the 'Misc' toolbox.)
+
::* Drag and drop a 'Delay' icon to follow the 'Component macro'.
  
* Locate the 'newLED' component, and use the down-arrow next to it to add it to the [[System Panel]]. It can now be used in the same way as any other electronic device.  
+
::* Double-click on it, rename it "One second delay" and change the unit to 'seconds'.
  
* Create a flowchart which uses the imported component.
+
::* Drag and drop a second 'Component macro' to follow the one second delay.
  
* Add a component macro to the flowchart, and double-click on it.  
+
::* Double-click on it. Rename it "Switch off" and select the 'LEDoff' macro. Click on 'OK'.
  
* Click on the 'Simulation' tab. The simulation macros, 'LEDoff' and 'LEDon',appear in the tree.  
+
::* Drag and drop a second 'Delay' icon after the second 'Component macro' and configure it as you did the first. (Alternatively, click on the first icon, and 'copy and paste' it, and then move it to the correct position in the flowchart.)
  
* Click on the one you want, and then click on 'OK'.  
+
* Your flowchart should now resemble the one shown below:
 +
[[File:gen_exercisetest_LEDimport_testflowchart.png|200px|center]]
  
* Simulate the flowchart, (see [[Exercise - Simulate a simple flowchart]]), to test whether the import has worked.
+
 
 +
* Simulate the flowchart, (see [[Exercise - Simulating a Program]]), to test whether the import has worked.

Latest revision as of 14:45, 13 March 2014

<sidebar>Sidebar: Flowcode Exercises:Ex3</sidebar>

  • Build the flowchart as follows:
  • Open the 'Outputs' toolbox, where you stored the exported 'newLED' component.
  • Locate the 'newLED' component, and use the down-arrow next to it to add it to the System Panel.
  • Drag and drop a 'Loop' icon onto the flowchart. Leave it in its default state, to loop indefinitely.
  • Drag and drop a 'Component macro' icon inside the loop.
  • Double-click on it so that you can configure it.
  • Click on the 'Simulation' tab to see the associated macros. You should see two, called 'LEDoff' and 'LEDon'.
  • Click on the 'LEDon' macro. Change the 'Display name' to "Switch on" and click 'OK'.
  • Drag and drop a 'Delay' icon to follow the 'Component macro'.
  • Double-click on it, rename it "One second delay" and change the unit to 'seconds'.
  • Drag and drop a second 'Component macro' to follow the one second delay.
  • Double-click on it. Rename it "Switch off" and select the 'LEDoff' macro. Click on 'OK'.
  • Drag and drop a second 'Delay' icon after the second 'Component macro' and configure it as you did the first. (Alternatively, click on the first icon, and 'copy and paste' it, and then move it to the correct position in the flowchart.)
  • Your flowchart should now resemble the one shown below:
Gen exercisetest LEDimport testflowchart.png