SimpleSwitch

From Flowcode Help
Jump to navigationJump to search

Here are the files to recreate the simple switch project.

File:SwitchDemo.zip


First if you look at the Events tab of the project explorer window you can see we have enabled several events and created macros for them.

  • Initialise - Called when the component is dragged onto the users panel
  • PinChange - Called when any of the associated pin properties change state
  • Click - Called when the mouse is clicked on any of the panel items
  • Release - Called when the mouse is released after clicking on any of the panel items


Using the Macros tab of the project explorer you can see the various macros and the code inside them.


On the properties window we have created three properties.

  • Switch Pin - The IO pin that we want to assign to the switch on the embedded hardware
  • State - The wiring of the switch, be it high or low when activated
  • Type - The type of switch, be it momentary or latching


In the export configuration we define the following.

  • Setup Tab - The name of the component, details such as cosmetic name and place on the component toolbar
  • Interface Tab - The public macros of the component and if they will download to an embedded target
  • Resources Tab - The files used by the component such as the switch image icons