This code make 2 LED blink one after other. LEDs are connected to PORT C (P0 and P1). Make sure use a 330 ohm resistance to protect your LED.
Code
1: /*
2: * Driving_2_LED_in_a_Fashion.c3: *4: * Created: 01-01-2013 PM 12:24:345: * Author: ANANTHAKRISHNAN.U.S6: */7:8:9: #include <avr/io.h>10: #include <util/delay.h>11:12: int main(void)13: {14: DDRC = 0b00000011;15: while(1)16: {17: PORTC = 0b00000001;18: _delay_ms(500);19: PORTC = 0b00000010;20: _delay_ms(500);21: }22: }
Comments
Post a Comment