質問編集履歴
2
削除された内容の復元を行いました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,45 @@
|
|
1
1
|
servo.write(A);の所で'A'was not declared in this scopeとエラーがでます。
|
2
2
|
|
3
3
|
どのように改善すればよいでしょうか。回答お願いします
|
4
|
+
|
5
|
+
#include<stdio.h>
|
6
|
+
|
7
|
+
#include<math.h>
|
8
|
+
|
9
|
+
#include<Servo.h>
|
10
|
+
|
11
|
+
Servo servo;
|
12
|
+
|
13
|
+
void setup(){
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
servo.attach(9);
|
18
|
+
|
19
|
+
double a,b,c,A,degree;
|
20
|
+
|
21
|
+
a=10;
|
22
|
+
|
23
|
+
b=20;
|
24
|
+
|
25
|
+
c=30;
|
26
|
+
|
27
|
+
A=acos((b*b+c*c-a*a)/2*b*c);
|
28
|
+
|
29
|
+
degree=A*180.0/PI;
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
void loop()
|
34
|
+
|
35
|
+
{
|
36
|
+
|
37
|
+
servo.write(A);
|
38
|
+
|
39
|
+
delay(1000);
|
40
|
+
|
41
|
+
servo.write(0);
|
42
|
+
|
43
|
+
delay(1000);
|
44
|
+
|
45
|
+
}
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,51 +1,3 @@
|
|
1
1
|
servo.write(A);の所で'A'was not declared in this scopeとエラーがでます。
|
2
2
|
|
3
3
|
どのように改善すればよいでしょうか。回答お願いします
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#include<stdio.h>
|
8
|
-
|
9
|
-
#include<math.h>
|
10
|
-
|
11
|
-
#include<Servo.h>
|
12
|
-
|
13
|
-
Servo servo;
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
void setup(){
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
servo.attach(9);
|
22
|
-
|
23
|
-
double a,b,c,A,degree;
|
24
|
-
|
25
|
-
a=10;
|
26
|
-
|
27
|
-
b=20;
|
28
|
-
|
29
|
-
c=30;
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
A=acos((b*b+c*c-a*a)/2*b*c);
|
34
|
-
|
35
|
-
degree=A*180.0/PI;
|
36
|
-
|
37
|
-
}
|
38
|
-
|
39
|
-
void loop()
|
40
|
-
|
41
|
-
{
|
42
|
-
|
43
|
-
servo.write(A);
|
44
|
-
|
45
|
-
delay(1000);
|
46
|
-
|
47
|
-
servo.write(0);
|
48
|
-
|
49
|
-
delay(1000);
|
50
|
-
|
51
|
-
}
|