
本文共 3072 字,大约阅读时间需要 10 分钟。
������������������������������������������������������������������Mbed OS������������������C++������������������������������������������������������������������������������������������������������������������������������������Mbed OS���������������������
���������������������������
���������������������������������������������������������������������������������1.8���������������������������������������������������
- ���������������������������������������������������������������
- ���������������������������������������������������������������������
- ���������������������������������������������������������������������������
- ���������������������������������������������������������
- ������������������������������������������������������.
���������������������������������������������������������������
- ������������������������������������������������������������
- ���������������������������������������������������������������������.
- ���������������������������3D������������������������������������������������.
������������������������������
������������������������4���5���������������A���B���C���D���������������2Hz���������������������������������������������������������������������������������������������������������������3-8KHz������������1.8���/���������������������.
Mbed OS������������������������
���Mbed OS���������������������������������������������C++������������������������.������������������������������
class StepperMotor {public: StepperMotor(PinName A0, PinName A1, PinName A2, PinName A3); void step(int num_steps, int direction, int speed = 1200); void clockwise(); void anticlockwise(); void stop();private: uint8_t state; DigitalOut _A0, _A1, _A2, _A3;};
���������������������������������������������������
step
������������������������������������������������������.clockwise
������������������������.anticlockwise
������������������������.stop
���������������������.
���������������������������
������������������������������������������������������������������������������2A���������������.������MOS������������������������������������������������BJTitional������������.
������������������
������������������������Mbed���������
#include "mbed.h"#include "StepperMotor.h"StepperMotor motor(PE_13, PE_14, PE_8, PB_1);int step_speed = 1200; // ���������������������1200������������int num_step = 200; // 200���=360���int main() { // ��������������� motor.stop(); motor.Anticlockwise(); wait(1); motor.step(200 * 2, 0, step_speed); // ������������������ wait(1); motor.step(200 * 2, 1, step_speed); // ������������������}
������������������������������������������������������������������������������������������������������������������.
������
���������������������������������������������������������������������������������������Mbed OS������������������������������������������������������������������������������.������������������������������C++������������������������������������������������������������������������������Precision Control���Robotic Control���������.
发表评论
最新留言
关于作者
