-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
executable file
·70 lines (52 loc) · 1.04 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
*/
#define F_CPU 16000000UL
#include <avr/io.h>
#include <avr/delay.h>
#include "keypad.h"
#include "lcd.h"
extern count_a;
void welcome_screen();
unsigned char access_allowed = 0;
int main(void)
{
DDRD |= (1<<3) | (1<<4);
adc0_init();
PWM_init0();
LCD_init();
Usonic_init();
_delay_ms(30);
while(1)
{
Usonic_trigger(); // send an ultrasonic trigger, reflection is measured with an interrupt
if(count_a<60) // wait till the distance becomes 6cm
{
welcome_screen();
default_screen();
while(1)
{
access_allowed = keypad_entry();
}
}
}
return 0;
}
void welcome_screen() // Display and shift Welcome!
{
unsigned char wel[22] = "!emocleW ";
unsigned char a=0, s=0, d=0;
for(a=1 ; a<25 ;a++)
{
LCD_clearScreen();
LCD_goToRowColumn(0,0);
d = a;
for(s=0 ; s<16 ;s++)
{
LCD_displayCharacter(wel[d-1]);
d--;
if(d==0) break;
}
_delay_ms(100);
}
=
}