Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <reg52.h>
- void delay(int n)
- {
- while (n--);
- }
- int main()
- {
- P0 = 0x00;
- P1 = 0xFF;
- while (1)
- {
- if (P1 & 0x1)
- {
- P0 = 0xFF;
- delay(160000);
- P0 = 0x00;
- delay(160000);
- } else
- {
- P0 = 0xFF;
- delay(10000);
- P0 = 0x00;
- delay(10000);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement