This repository was archived by the owner on Dec 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
74 lines (58 loc) · 1.3 KB
/
main.c
File metadata and controls
74 lines (58 loc) · 1.3 KB
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
71
72
73
#include <stdio.h>
#include <wiringPi.h>
#include <stdlib.h>
#include <unistd.h>
#include "Yul_LCD.h"
#define button_gpio 7 //gpio 4
#define led_gpio 0 //gpio 17
int flagl = 0;
void workMotor(){
system("python ./motor");
}
void takePhoto(){//파이 카메라
system("./photo.sh yf1");
}
int scanButton (int btn_scan){
if(digitalRead (btn_scan== HIGH)){ // Low is pushed
return 1; }
flagl ^= 1;
digitalWrite(led_gpio, flagl);
// takePhoto();
workMotor();
while(digitalRead (btn_scan) == LOW){
delay(10);
}
return 1;
}
int start (int num)
{
int button_flag = 0;
int lcd_flag;
printf ("param %d \n",num);
if (wiringPiSetup () == -1)
return 1;
pinMode (led_gpio, OUTPUT);
digitalWrite(led_gpio, 0);
pinMode (button_gpio, INPUT);
pullUpDnControl (button_gpio, PUD_UP);
scanButton(button_flag);
lcd_flag=num;
switch(lcd_flag){
case 1:
lcdOn_nowstat(lcd_flag);
break;
case 2:
lcdOn_nowstat(lcd_flag);
break;
case 3:
lcdOn_feedstat(lcd_flag);
break;
}
delay(1);
return 0;
}
int main (int argc, char *argv[]){
int num = atoi(argv[1]);
start(num);
return 1;
}