-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
37 lines (31 loc) · 934 Bytes
/
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
#include "elev.h"
#include "controll.h"
#include "order.h"
#include <stdio.h>
#include <stdlib.h>
int main() {
// Initialize hardware
if (!elev_init()) {
printf("Unable to initialize elevator hardware!\n");
return 1;
}
printf("Press STOP button to stop elevator and exit program.\n");
/*
elev_set_motor_direction(DIRN_UP);
while (1) {
//Initialize, stop at first floor
if (elev_get_floor_sensor_signal() == N_FLOORS - 1) {
elev_set_motor_direction(DIRN_DOWN);
} else if (elev_get_floor_sensor_signal() == 0) {
elev_set_motor_direction(DIRN_STOP);
break;
}
// Stop elevator and exit program if the stop button is pressed
if (elev_get_stop_signal()) {
elev_set_motor_direction(DIRN_STOP);
break;
}
}*/
controll();
return 0;
}