【花雕动手做】尝试使用不同舵机来控制中空旋转平台(机械臂底盘)
项目:使用10K电位器模块控制S3003舵机位置
[code]/*
【花雕动手做】尝试使用不同舵机来控制中空旋转平台(机械臂底盘)
项目:使用10K电位器模块控制S3003舵机位置
*/
#include Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value // between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value
// between 0 and 180)
myservo.write(val); // sets the servo position according to the
// scaled value
delay(15); // waits for the servo to get there
}[/code]
项目:使用10K电位器模块控制S3003舵机位置
[code]/*
【花雕动手做】尝试使用不同舵机来控制中空旋转平台(机械臂底盘)
项目:使用10K电位器模块控制S3003舵机位置
*/
#include
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value // between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value
// between 0 and 180)
myservo.write(val); // sets the servo position according to the
// scaled value
delay(15); // waits for the servo to get there
}[/code]
项目:测试舵机步进转动
[code]/*
【花雕动手做】尝试使用不同舵机来控制中空旋转平台(机械臂底盘)
项目:测试舵机步进转动
*/
#include
Servo myservo; // 创建一个舵机对象
int pos = 0; // 变量pos用来存储舵机位置
void setup() {
myservo.attach(9); // 将引脚9上的舵机与声明的舵机对象连接起来
}
void loop() {
for (pos = 0; pos < 180; pos += 1) { // 舵机从0°转到180°,每次增加1°
myservo.write(pos); // 给舵机写入角度
delay(15); // 延时15ms让舵机转到指定位置
}
for (pos = 180; pos >= 1; pos -= 1) { // 舵机从180°转回到0°,每次减小1°
myservo.write(pos); // 写角度到舵机
delay(15); // 延时15ms让舵机转到指定位置
}
}[/code]
项目:最简单的伺服电机程序
[color=#95a5a6]
[/color]
[code]/*
【花雕动手做】尝试使用不同舵机来控制中空旋转平台(机械臂底盘)
项目:最简单的伺服电机程序
*/
#include
Servo myservo;
void setup() {
myservo.attach(9);
}
void loop() {
myservo.write(0);
delay(1000);
myservo.write(90);
delay(1000);
myservo.write(180);
delay(1000);
myservo.write(90);
delay(1000);
}[/code]
[/font][/backcolor]
Futaba S3003舵机 180度 38克 5V 3.5KG/CM
MG996R 金属舵机 180度 55克 5V 13KG/CM
MG996R 金属舵机 360度 55克 5V 13KG/CM
CAN 总线金属舵机 360度 220克 24V 60KG/CM