Created
November 30, 2018 06:23
-
-
Save elktros/3395aad49a92461514205f0b2f9b5417 to your computer and use it in GitHub Desktop.
Code for Bipolar LED Driver Circuit using 8051 Microcontroller.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<reg51.h> | |
sbit red = P0^0; | |
sbit green = P0^1; | |
sbit red_switch = P0^6; | |
sbit green_switch = P0^7; | |
unsigned char i=0; | |
void delay (int); | |
void main() | |
{ | |
red=0; | |
green=0; | |
while(1) | |
{ | |
if(red_switch==0) | |
{ | |
green=0; | |
red=1; | |
while(red_switch==0); | |
} | |
else if(green_switch==0) | |
{ | |
green=1; | |
red=0; | |
while(green_switch==0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment