Quantcast
Channel: Microcontrollers, Programming and IoT
Viewing all articles
Browse latest Browse all 1271

Program to check three Switch button's

$
0
0
Hello

I have three button's and two light's and one Fan. I want to make light1 ON if switch 1 is pressed otherwise turn of light 1. turn ON light2 ON if switch 2 is pressed otherwise turn of light 2. turn ON Fan 1 if switch 3 is pressed otherwise turn of Fan 1.

Code:
#include<89v51rx2.h>

sbit Light1 = P1^0;      /*set bit P1^0 to Light 1*/
sbit Light2 = P1^1;      /*set bit P1^1 to Light 2*/
sbit Fan1   = P1^2;      /*set bit P1^2 to Fan 1*/

sbit  Switch1 = P2^0;     /*set bit P2^0 to...
Program to check three Switch button's

Viewing all articles
Browse latest Browse all 1271

Trending Articles