Final

Committer:
jbeason3
Date:
Wed Nov 06 04:53:49 2019 +0000
Revision:
0:e0bfe92fd649
Final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jbeason3 0:e0bfe92fd649 1 #include "Motor_Driver.h"
jbeason3 0:e0bfe92fd649 2
jbeason3 0:e0bfe92fd649 3 //initialization function
jbeason3 0:e0bfe92fd649 4 BLDR::BLDR(PinName in1, PinName in2, PinName pwm):
jbeason3 0:e0bfe92fd649 5 _pwm(pwm), _in1(in1), _in2(in2) {
jbeason3 0:e0bfe92fd649 6 _pwm.period(0.01);
jbeason3 0:e0bfe92fd649 7 }
jbeason3 0:e0bfe92fd649 8
jbeason3 0:e0bfe92fd649 9 void BLDR::set_dir(int dir){
jbeason3 0:e0bfe92fd649 10 if(dir==1){
jbeason3 0:e0bfe92fd649 11 _in1=1;
jbeason3 0:e0bfe92fd649 12 _in2=0;
jbeason3 0:e0bfe92fd649 13 }
jbeason3 0:e0bfe92fd649 14 if(dir==-1){
jbeason3 0:e0bfe92fd649 15 _in1=0;
jbeason3 0:e0bfe92fd649 16 _in2=1;
jbeason3 0:e0bfe92fd649 17 }
jbeason3 0:e0bfe92fd649 18 }
jbeason3 0:e0bfe92fd649 19
jbeason3 0:e0bfe92fd649 20 void BLDR::set_duty(float dc){
jbeason3 0:e0bfe92fd649 21 _pwm.write(dc);
jbeason3 0:e0bfe92fd649 22 }