PDF 組裝手冊
這是一個高手的DIY : 袖珍版機械手臂 MeArm
MeArm V0.4 的零件圖下載點
可變電阻控制伺服馬達
|
https://goo.gl/SX7y9i |
利用電位器控制 meArm | https://goo.gl/KqhQqp |
MeArm組裝說明(中文) | https://goo.gl/sNdVjB |
MeArm組裝說明 | https://goo.gl/ollblX |
Arduino 程式
// by Michal Rinott
// Used Michal's code but x4 to control the MeArm v0.3 - Ben Gray
#include <Servo.h>
Servo myservo0, myservo1, myservo2, myservo3 ; // 4個馬達
int potpin0 = 0; // analog pin used to connect the potentiometer
int potpin1 = 1; // analog pin used to connect the potentiometer
int potpin2 = 2; // analog pin used to connect the potentiometer
int potpin3 = 3; // analog pin used to connect the potentiometer
int val0; // variable to read the value from the analog pin
int val1; // variable to read the value from the analog pin
int val2; // variable to read the value from the analog pin
int val3; // variable to read the value from the analog pin
void setup()
{
Serial.begin(9600);
//Serial.println("CLEARDATA");
//Serial.println("LABEL,Time,Timer,val0,val1,val2,val3");
myservo0.attach(11); // attaches the servo on pin 11 to the servo object
myservo1.attach(10); // attaches the servo on pin 10 to the servo object
myservo2.attach(9); // attaches the servo on pin 9 to the servo object
myservo3.attach(6); // attaches the servo on pin 6 to the servo object
}
void loop()
{
val0 = analogRead(potpin0);// 讀取電位 (value between 0 and 1023)
val0 = map(val0, 0, 800,179,0); // 轉換為servor角度 (value between 0 and 180)
myservo0.write(val0); // 馬達旋轉位置
// Serial.println(val0);
delay(40); // waits for the servo to get there
val1 = analogRead(potpin1);
val1 = map(val1, 0, 1023, 0, 179);
myservo1.write(val1);
// Serial.println(val1);
delay(40);
val2 = analogRead(potpin2);
val2 = map(val2, 0, 1023, 0, 179);
myservo2.write(val2);
//Serial.println(val2);
delay(40);
val3 = analogRead(potpin3);
val3 = map(val3, 0, 1023, 0, 179);
myservo3.write(val3);
// Serial.println(val3);
delay(40);
/* Serial.print("DATA,TIME");
Serial.print(",");
Serial.print("TIMER");
Serial.print(",");
Serial.print(val0);
Serial.print(",");
Serial.print(val1);
Serial.print(",");
Serial.print(val2);
Serial.print(",");
Serial.println(val3);
*/
}
// Used Michal's code but x4 to control the MeArm v0.3 - Ben Gray
#include <Servo.h>
Servo myservo0, myservo1, myservo2, myservo3 ; // 4個馬達
int potpin0 = 0; // analog pin used to connect the potentiometer
int potpin1 = 1; // analog pin used to connect the potentiometer
int potpin2 = 2; // analog pin used to connect the potentiometer
int potpin3 = 3; // analog pin used to connect the potentiometer
int val0; // variable to read the value from the analog pin
int val1; // variable to read the value from the analog pin
int val2; // variable to read the value from the analog pin
int val3; // variable to read the value from the analog pin
void setup()
{
Serial.begin(9600);
//Serial.println("CLEARDATA");
//Serial.println("LABEL,Time,Timer,val0,val1,val2,val3");
myservo0.attach(11); // attaches the servo on pin 11 to the servo object
myservo1.attach(10); // attaches the servo on pin 10 to the servo object
myservo2.attach(9); // attaches the servo on pin 9 to the servo object
myservo3.attach(6); // attaches the servo on pin 6 to the servo object
}
void loop()
{
val0 = analogRead(potpin0);// 讀取電位 (value between 0 and 1023)
val0 = map(val0, 0, 800,179,0); // 轉換為servor角度 (value between 0 and 180)
myservo0.write(val0); // 馬達旋轉位置
// Serial.println(val0);
delay(40); // waits for the servo to get there
val1 = analogRead(potpin1);
val1 = map(val1, 0, 1023, 0, 179);
myservo1.write(val1);
// Serial.println(val1);
delay(40);
val2 = analogRead(potpin2);
val2 = map(val2, 0, 1023, 0, 179);
myservo2.write(val2);
//Serial.println(val2);
delay(40);
val3 = analogRead(potpin3);
val3 = map(val3, 0, 1023, 0, 179);
myservo3.write(val3);
// Serial.println(val3);
delay(40);
/* Serial.print("DATA,TIME");
Serial.print(",");
Serial.print("TIMER");
Serial.print(",");
Serial.print(val0);
Serial.print(",");
Serial.print(val1);
Serial.print(",");
Serial.print(val2);
Serial.print(",");
Serial.println(val3);
*/
}