Beruflich Dokumente
Kultur Dokumente
The board has 5 onboard LEDs generally used to show the status of line sensors, that means
when a black line comes just in the front of line sensor, corresponding LED is turned on. Each
LED has a numeric id between 1-5.
LED id
PCB Marking
MCU I/O
D9 LEFT MOST
PD7
D8
PD6
D7
PD5
D6
PD4
D5 RIGHT
MOST
PB0
LEDs can be controlled using the LED library that comes in as following files.
led.c
led.h
You can get these files from the lib folder in the DVD.
To use the LED Library do the following :1. Create a new folder lib in the project using Solution Explorer.
2. Create a new sub folder led inside the lib folder.
3. Using Windows File Manager copy/paste the led.c and led.h files to your <project
folder>/lib/led/ from the DVD.
Sample Program
The following sample program turns on each LED from id 1 to 5, then turns them off one by
one from id 1 to 5.
/
*************************************************************************
*****
LFR Board Sample Programs
-----------------------------------Description : The following sample program turns on each LED from id 1
to 5,
then turns them off one by one from id 1 to 5.
This whole process is repeated again and again.
Author
Web
*************************************************************************
*****/
#include <avr/io.h>
#include <util/delay.h>
#include "lib/led/led.h"
void Wait();
int main(void)
{
LEDInit();
while(1)
{
uint8_t i;
for (i=1;i<=5;i++)
{
LEDOn(i);
}
Wait();
for (i=5;i>0;i--)
{
LEDOff(i);
Wait();
}
}
void Wait()
{
uint8_t i;
for(i=0;i<30;i++)
{
_delay_loop_2(0);
}
}
LEDDemo1.hex