質問編集履歴
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,55 @@
|
|
7
7
|
どなたか実装方法を教えてください。
|
8
8
|
|
9
9
|
またより良い考え方があればそちらを教えていただきたいです。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
コードを下に書いておきます(追記)
|
14
|
+
|
15
|
+
```C言語
|
16
|
+
|
17
|
+
#include<stdio.h>
|
18
|
+
|
19
|
+
#include<wiringPi.h>
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
#define GPIO4 4
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
int main(void){
|
28
|
+
|
29
|
+
int value=0,i;
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
//Initialize
|
34
|
+
|
35
|
+
if(wiringPiSetupGpio() == -1) return 1;
|
36
|
+
|
37
|
+
pinMode(GPIO4, INPUT);
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
//recieve
|
42
|
+
|
43
|
+
for(i=0;i<100;i++){
|
44
|
+
|
45
|
+
value = digitalRead(GPIO4);
|
46
|
+
|
47
|
+
printf("%d",value);
|
48
|
+
|
49
|
+
delay(50);
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
printf("\n");
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
return 0;
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
```
|