arduino - 我尝试的代码无法运行 blcd 电机
问题描述
我正在使用 Arduino uno3 制作无控制无人机,并希望在其上运行 bldc 电机。我还提供了合适的电压电池。但是,电机根本不运行。
我什么都试过了。我在谷歌上找到的校准代码可以正常工作。该代码旨在将 int 值放入串行监视器中。我不使用串行监视器,所以我将一个 int 值作为 motor.writeMicroseconds 函数的参数传递。但它根本不起作用。我几乎尝试了一切,但失败了。我把正确的别针放在板上。但它仍然没有工作。
int MAX_SIGNAL 2000
int MIN_SIGNAL 1000 //signals
int MOTOR_PINA 9
int MOTOR_PINB 8
int MOTOR_PINC 7
int MOTOR_PIND 6
Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4; //motorpin init
void setup() {
Serial.begin(9600);
motor1.attach(MOTOR_PINA,1000,2000);
motor2.attach(MOTOR_PINB,1000,2000);
motor3.attach(MOTOR_PINC,1000,2000);
motor4.attach(MOTOR_PIND,1000,2000); //motor connect to board, set min,max speed
motor1.writeMicroseconds(MAX_SIGNAL);
motor2.writeMicroseconds(MAX_SIGNAL);
motor3.writeMicroseconds(MAX_SIGNAL);
motor4.writeMicroseconds(MAX_SIGNAL);
delay(100);
motor1.writeMicroseconds(MAX_SIGNAL);
motor2.writeMicroseconds(MAX_SIGNAL);
motor3.writeMicroseconds(MAX_SIGNAL);
motor4.writeMicroseconds(MAX_SIGNAL);
//calibration
}
void loop() {
int DELAY = 1200;
motor1.writeMicroseconds(DELAY);
motor2.writeMicroseconds(DELAY);
motor3.writeMicroseconds(DELAY);
motor4.writeMicroseconds(DELAY);
delay(1000);
}
没有错误消息。但电机不运转。
解决方案
推荐阅读
- zoho - 如何在蓝图中的自动流上添加条件?
- html - bootstrps 5如何限制页数
- ios - Ionic/cordova-sms-plugin 打开带有较长文本的短信应用,Ionic 工具栏消失
- facebook - 在 Prestashop 上显示 3 个最后的 Facebook 帖子
- django - django_redis、channels_redis、asgi_redis和redis服务器有什么区别?
- javascript - 使用 Electron 时如何在文件之间共享变量?
- python-3.x - 排序后的Python Treeview交替行着色
- php - 选择多个下拉列表后从数据库中获取值
- asp.net-core - ASP.NET Core MVC:实现保存和新建功能
- monads - 记录字段上的状态单子