質問編集履歴
1
void loop内部を変更してみました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,23 +22,30 @@
|
|
22
22
|
Wire.begin(0, 26, 5000);
|
23
23
|
}
|
24
24
|
|
25
|
-
|
26
|
-
|
27
25
|
void loop() {
|
28
26
|
Serial.print(cds_out);
|
29
27
|
Serial.println(cds_out);
|
30
28
|
cds_out = analogRead(36);
|
31
29
|
|
30
|
+
|
32
31
|
int i;
|
33
32
|
if(cds_out>=5000){
|
33
|
+
|
34
|
+
writeMotorResister(motor, 0x18, 0x01);
|
34
35
|
i++;
|
36
|
+
|
35
37
|
delay(50);
|
36
38
|
}
|
37
39
|
|
38
40
|
if ( i>3) {
|
41
|
+
delay(10000);
|
39
42
|
writeMotorResister(motor, 0x18, 0x01);
|
40
43
|
|
41
44
|
}
|
42
45
|
|
43
46
|
}
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
}
|
44
51
|
```M5StickCとCdsセンサが暗所を感知し,(Cds>5000)が三回カウントしたらモータードライブが停止というプログラムを組んだのですが三回カウントしても停止しません。どこを修正したらいいか教えていただきたいです。
|