-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_final.c
62 lines (43 loc) · 1.5 KB
/
main_final.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
// led on if exceed 100 m
void led_on(long double dist)
{
if (dist >= 100.0)
GPIO_PORTF_DATA_R = 0x02;
}
int main(){
initialize(); //Call the initialization of the GPIO of tiva
initalizeLCD();
/*Call the intialization commands, data length set, then clear the lcd screen
of any previous data, return home command, and turning the display on + controlling the cursor*/
init_uart(); //uart ports initializations'
while(1){
GPIO_PORTF_DATA_R &= ~0x02;
dist = 0.0;
/*print on the lcd the message to print for the gps programe to start by using SW2*/
printOnLCD(Start0, 1); //press SW2 to, 1stROW
printOnLCD(Start1, 2);//Start 2ndROW
while((GPIO_PORTF_DATA_R & 0x10)){
if (!(GPIO_PORTF_DATA_R & 0x01)){
printOnLCD(Stop0, 1);
printOnLCD(Stop1, 2);
delay10Ns(10000000); //delay 10 seconds
/*printing on lcd the word "Distance= " and the calculated distance right after it. AT 1stROW*/
printOnLCD(Distance, 1);
printDist(dist);
while((GPIO_PORTF_DATA_R & 0x10)){
/* o is a variable set to idintefy if the recived data from the gps are correct, after reseting the value of O to 0 and then re-check*/
lat_long();
if (o == 1)
{
Total_distance(long2,lat2) ;
}
o = 0 ;
printDist(dist);
led_on(dist); //red led on after dist value reachs 100meter
}
printOnLCD(Stop2, 2);
delay10Ns(1000000); //delay 10 seconds
}
}
}
}