Making a Blinking LED using Eclipse and WinAVR
In Eclipse Create a new project and a source file and make the settings.
Now write a code to blink an led.
Sample code 1:
#include <avr/io.h>
#include <util/delay.h>
int main()
{
DDRD=255;
while(1)
{
PORTD=0b11111111;
_delay_ms(1000);
PORTD=0b00000000;
_delay_ms(1000);
}
}
Sample code2 :
#include <avr/io.h>
#include <util/delay.h>
int main()
{
DDRD=255;
while(1)
{
PORTD=0b10101010;
_delay_ms(1000);
PORTD=0b00000000;
_delay_ms(1000);
}
}
transfer the code to heythi kit. Place the led pcb at portD as the ground of led pcb connected to the ground with the portD in heythi kit and check the output.
Making a Blinking LED using Arduino-Compatible Software
Open Arduino.exe and create a new file and change the board and programmer settings and write the code in the new file.
Sample Code:
void setup() {
// initialize the digital pin as an output.
DDRB =B11111111;
}
// the loop routine runs over and over again forever:
void loop() {
PORTB=B00001111;
delay(100);
PORTB=B11110000;
delay(100);
}
Now Save it,compile it and upload it and check the output by placing the led pcb at portb output pins.