电机的驱动,实际上是运用L9110
L9110是为控制和驱动电机设计的两通道推挽式功率放大专用集成电路器件,将分立 电 路 集 成 在 单 片IC之 中 , 使 外 围 器 件 成 本 降 低 , 整 机 可 靠 性 提 高 。 该 芯 片 有 两 个 TTL/CMOS 兼容电平的输入,具有良好的抗干扰性;两个输出端能直接驱动电机的 正反向运动及刹车,它具有较大的电 流驱动能力,每通道能通过750~800mA的持续 电 流,峰值电流能力可达1.5~2.0A;同时它具有较低的输出饱和压降;内置的钳位二极管能 释放感性负载的反向冲击电流,使它在驱动 继电器、直 流电 机、步进电机或 开关功率 管的使用上安全可靠。L9110被广泛应用于保险柜、玩具汽车的电机驱动、步进电机驱 动和开关功率管等电路上。
逻辑功能真值表
向前
analogWrite( 3 , 0 );
analogWrite(5,255);
analogWrite( 6 , 0 );
analogWrite(9,255);
左向前
analogWrite( 3 , 0 );
analogWrite(5,255);
左向后
analogWrite( 3 , 255 );
analogWrite(5,0);
右向前
analogWrite( 6 , 0 );
analogWrite(9,255);
右向后
analogWrite( 6 , 255 );
analogWrite(9,0);
左大弯
analogWrite( 3 , 0 );
analogWrite(5,200);
analogWrite( 6 , 0 );
analogWrite(9,255);
以左轮为轴左360转
analogWrite( 3 , 0);
analogWrite(5,0);
analogWrite( 6 , 0 );
analogWrite(9,255);
左原地转
analogWrite( 3 , 255 );
analogWrite(5,0);
analogWrite( 6 , 0 );
analogWrite(9,255);
- void setup()
- {
- pinMode( 3 , OUTPUT );
- pinMode( 5 , OUTPUT );
- pinMode( 6 , OUTPUT );
- pinMode( 9 , OUTPUT );
- }
- void loop()
- {
- analogWrite( 3 , 0 );
- analogWrite(5,200);
- analogWrite( 6 , 0 );
- analogWrite(9,255);
- delay( 3000 );
- analogWrite( 3 , 0 );
- analogWrite(5,0);
- analogWrite( 6 , 0 );
- analogWrite(9,200);
- delay( 3000 );
- analogWrite( 3 , 200 );
- analogWrite(5,0);
- analogWrite( 6 , 0 );
- analogWrite(9,200);
- delay( 3000 );
- analogWrite( 3 , 0 );
- analogWrite(5,0);
- analogWrite( 6 , 0 );
- analogWrite(9,0);
- delay( 3000 );
-
- }
复制代码
三种旋转方式
|