###前提・実現したいこと
Arduinoとサーボモータ(SG90)3つを使って、数字を描くロボットアームを作っています。PlotClockというデジタル時計を実現したプロトタイプが存在し、以下がその参考にしているサイトです。
Thingiverse
GitHub
製作手順が詳細に載っているページ
###発生している問題・エラーメッセージ
すでにあるコードは時間を読み取ってそれに応じて数字を描くものなので、1や2など数字を描く部分だけを各部分を取り出したいと思っているのですが、該当部分だと思われるものを取り出してArduinoの書き込んでも動かないという事態が発生しています。
エラーとしては「'deawTo' was not declared in this scope」と表示されています。
長ずぎるため、元のコードはURLで貼ります
元のArduinoコード
「0」を描くために該当部分と思われるものを取り出したコード
###Arduino
Arduino
1// delete or mark the next line as comment when done with calibration 2#define CALIBRATION 3 4// When in calibration mode, adjust the following factor until the servos move exactly 90 degrees 5#define SERVOFAKTOR 620 6 7// Zero-position of left and right servo 8// When in calibration mode, adjust the NULL-values so that the servo arms are at all times parallel 9// either to the X or Y axis 10#define SERVOLEFTNULL 1900 11#define SERVORIGHTNULL 984 12 13#define SERVOPINLEFT 3 14#define SERVOPINRIGHT 4 15 16// length of arms 17#define L1 35 18#define L2 55.1 19#define L3 13.2 20 21// origin points of left and right servo 22#define O1X 22 23#define O1Y -25 24#define O2X 47 25#define O2Y -25 26 27#include <Servo.h> 28 29void setup() { 30 // put your setup code here, to run once: 31 drawTo(75.2, 47); 32 lift(0); 33 34 servo2.attach(SERVOPINLEFT); // left servo 35 servo3.attach(SERVOPINRIGHT); // right servo 36 delay(1000); 37} 38 39void loop() { 40 // put your main code here, to run repeatedly: 41 42 43 // Servohorns will have 90° between movements, parallel to x and y axis 44 drawTo(-3, 29.2); 45 delay(500); 46 drawTo(74.1, 28); 47 delay(500); 48 49} 50 51void number(float bx, float by, int num, float scale) { 52 53 switch (num) { 54 55 case 0: 56 drawTo(bx + 12 * scale, by + 6 * scale); 57 lift(0); 58 bogenGZS(bx + 7 * scale, by + 10 * scale, 10 * scale, -0.8, 6.7, 0.5); 59 lift(1); 60 break; 61 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/07/05 23:07
2017/07/06 00:10
退会済みユーザー
2017/07/06 03:16