How to blink 4 LEDs in your robotic kit?

This is the FIRST PROGRAM in your course of FUNDAMENTALS OF ROBOTICS. To use this program, you must use our robotics kit already supplied to you.

If you do not have this kit, then you can purchase our distance learning programme in robotics or contact us to join our regular batches of robotics.

Now read the following program carefully and work as per the given instructions, to enjoy your first program in robotics.

To use this program directly for your robotic kit, copy it, create new project in AVR Studio and then paste it into the coding area. Then compile it.

	Level II project of 4 LEDs Blinker 
	Applicable to ATMega8/16/32/128
	Designed by: Vidyasagar Academy, Akola

	PB4-PB1 	: output pins of PORTB, connected to 4 LEDs


#define F_CPU 12000000UL // defining the crystal frequency 12MHz 
			// given on your dev. board of ATMega8

#include <avr/io.h> // including the input-output 
		// to define the input output ports and pins
		// this file is inside the AVR folder 					

#include <util/delay.h> // including the delay file
			// this file is inside the 
			// utilities (util) folder

	int main() // starting the main function of program

	{ // main function brace opened

	DDRB=0b00011110; // PB4-PB1 of PORTB are defined as output pins

	while(1) // starting the infinite loop to repeat the action infinitely
	{ // while loop brace opened

	PORTB=0b00000000; // PB4-PB1 producing '0' output
			// so the 4 LEDs are OFF
	_delay_ms(1000); // the LEDs remain OFF for 1000ms=1sec

	PORTB=0b00011110; // PB4-PB1 producing '1' output
			// so the 4 LEDs become ON
	_delay_ms(2000); // the LEDs remain ON for 1000ms=1sec
	} // while loop brace closed

	} // main function brace closed

	1) First read the program carefully. Understand the steps as taught to you.
	2) Connect your kit to USB port.
	3) Burn the 'hex' file into your kit.
	4) All the LEDs connected to PB4-PB1 will glow for some time
	5) After some time all the LEDs will be OFF.
	6) This on/off will repeat continuously till the battery is connected.
	9) Is it working? Nice! You did it.
	10) Now don't forget to give your feedback.