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.

๏ปฟ

Lighting Controller
Lighting Controller
๏ปฟ

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.

LD MIc
LD MIc
๏ปฟ

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๏ปฟ

๏ปฟ