arduino の初心者です。
質問なのですが、以前コンパイルができていた(はず,,)なのですが、
久しぶりにRUNしようとしたら
『 variable or field 'setup' declared 』
というエラーが出ました。
何が起こっているのかわからないです、、
やろうとしていることはservo motor2つを半固定ボリューム2つで制御して動かそうとしています。
arduino
1#include <Servo.h> 2Servo servo1; 3Servo servo2; 4 5const int analogInPin1 = A0; 6const int analogInPin2 = A1; 7 8int pos1 = 0; // variable to store the servo position 9int pos2 = 0; 10 11void setup{ 12 pinMOde(1,OUTPUT); 13 servo1.attach(9); 14 servo2.attach(5); 15 Serial.begin(9600); 16} 17 18void loop(){ 19 for(pos1 = 0; pos1 <= 180; pos1 += 20){ 20 pos1 = analogRead(analogInPin1); 21 pos1 = map(pos1, 0, 1023, 0, 179); 22 servo1.write(pos1); 23 delay(15); 24 } 25 26 for(pos2 = 0; pos2 <= 180; pos2 += 20){ 27 pos2 = analogRead(analogInPin2); 28 pos2 = map(pos2, 0, 1023, 0, 179); 29 servo2.write(pos2); 30 delay(15); 31 } 32} 33
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/18 23:46
2018/07/18 23:49
2018/07/18 23:50
2018/07/18 23:54
2018/07/18 23:56
2018/07/19 00:32
2018/07/19 00:33
2018/07/19 00:46 編集
2018/07/19 01:04