Skip to content

Instantly share code, notes, and snippets.

@d-boz-wtwh
Created October 22, 2019 21:03
Show Gist options
  • Save d-boz-wtwh/552db064ac5a2acf8924f296b53ff099 to your computer and use it in GitHub Desktop.
Save d-boz-wtwh/552db064ac5a2acf8924f296b53ff099 to your computer and use it in GitHub Desktop.
Microcontroller Projects
#include<reg52.h>
sbit button=P1^0; //Push button pin declared
sbit led=P1^1; //Led pin declared
void main()
{
P1=0x01; //Push button as input and led as output
while(1){ //Control will remain in while loop for ever
if(button==1) //Button status check
led=1; //If pressed switch on led
else
led=0; //If noting led off
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment