什么都好说,但是贵。。。怎么解决 |
要做机器人,直流电机功率太低,怎么办?上无刷电机吧 首先你需要以下的东西 Arduino 电子调速器(航模用的) 无刷电机, 电线 电烙铁/焊锡 电池(根据电子调速器选择搭配) 然后将以上的东西连接起来 将调速器的伺服线中白色的信号线连接到arduino的9引脚正极(红色)连接到vin引脚将负极(黑色)连接到gnd引脚(arduino插上电脑时必须将正负极拔下,否则有可能会烧坏电脑一些部件) 将调速器和电机连接在一起 代码 //This code can be used for any purpose. #include Servo ESC1; int pos = 0; //Sets position variable void arm(){ setSpeed(0); //Sets speed variable delay(1000); } void setSpeed(int speed){ int angle = map(speed, 0, 100, 0, 180); //Sets servo positions to different speeds ESC1.write(angle); } void setup() { ESC1.attach(9); //Adds ESC to certain pin. arm(); } void loop() { int speed; //Implements speed variable for(speed = 0; speed <= 70; speed += 5) { //Cycles speed up to 70% power for 1 second setSpeed(speed); //Creates variable for speed to be used in in for loop delay(1000); } delay(4000); //Stays on for 4 seconds for(speed = 70; speed > 0; speed -= 5) { // Cycles speed down to 0% power for 1 second setSpeed(speed); delay(1000); } setSpeed(0); //Sets speed variable to zero no matter what delay(1000); //Turns off for 1 second } |