Hi,
I recieved my AVR programmer device last week so, i wrote my first LED blinking program in C (AVR). I used ATMEGA328P-PU chip. Earlier i have assembled my own arduino board so i used the same board for AVR by erasing the bootloader. below is my code
Please note that my LED is connected on PIN13.
I will be also writing pushbutton code which i will be posting here soon.
Cheers,
Ujjwal Soni
I recieved my AVR programmer device last week so, i wrote my first LED blinking program in C (AVR). I used ATMEGA328P-PU chip. Earlier i have assembled my own arduino board so i used the same board for AVR by erasing the bootloader. below is my code
#include <avr/io.h> #include <util/delay.h> /* @author Ujjwal Soni Connect a LED between pin 13 and GND. */ void delay() { unsigned char counter = 0; while (counter != 50) { /* wait (30000 x 4) cycles = wait 120000 cycles */ _delay_loop_2(30000); counter++; } } int main(void) { /* Initialization, set PB5 (arduino digital pin 13) as output */ DDRB |= (1<<PB5); while (1) { PORTB |= (1<<PB5); //arduino digital pin 5 -> 5V delay(); PORTB &= ~(1<<PB5); //arduino digital pin 5 -> GND delay(); } return 0; }
Please note that my LED is connected on PIN13.
I will be also writing pushbutton code which i will be posting here soon.
Cheers,
Ujjwal Soni
1 comment:
Autopal Merito – Excellence in lighting manufacture of LED, Spot, Indoor, COB, Flood, LGP, Panel Lightings and Series. A New Solution for Tomorrow’s Evolution. We are LED Manufacturing specialist, Exporters, Supplier in India.
Residential Led Lighting
Best Led Lights Company
Post a Comment