Knowledge Base
Applied Automation Using Embed...
Lighting Example
5min
the following example illustrates how to implement a basic double pole, and double throw switch arrangement program purpose setting up a lighting system for users to switch on/off the light whether they are at the bottom or the top of the stairs hardware device role xsw1 xsw1 turns on when the bottom switch is turned to the right xsw2 xsw2 turns on when the top switch is turned to the right ylight stair light software the following program example is easily created using ld micro i/o role rb0 switch 1 rb1 switch 2 rd0 light program description if the states of the bottom switch and the top switch are the same, both on or off, the light will be on if different, one is on and the other is off, the light will be off when the light is off, users can turn on the light by changing the state of either top switch at the bottom switch of the stairs likewise, when the light is on, users can turn off the light by changing the state of one of the two switches all code samples available on github https //github com/haventech/ldmicro examples pic16f887 https //github com/haventech/ldmicro examples pic16f887