Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <mega32.h>
- #include<delay.h>
- // Declare your global variables here
- void main(void)
- {
- // Declare your local variables here
- DDRC = 0b00001111; // pin 3 of Port C is set as Output
- DDRB = 0b00000000; // pin 0, 1, 2, 3, 4, 5, 6, 7 of Port B is set as Input
- while (1)
- {
- // Place your code here
- if (PINB.5 == 0)
- {
- PORTC = 0b00001111; // pin 3 of Port C voltage is High
- delay_ms(200);
- }
- else
- {
- PORTC = 0b00000000; // pin 3 of Port C voltage is Low
- delay_ms(200);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement