CRAC-LIB

Dependents:   Asserv_mot Asserv_mot

Committer:
Brand101
Date:
Wed Apr 19 17:41:26 2017 +0000
Revision:
0:cbe368f18aeb
B1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Brand101 0:cbe368f18aeb 1 #include "mbed.h"
Brand101 0:cbe368f18aeb 2 #include "MYCRAC_utility.h"
Brand101 0:cbe368f18aeb 3
Brand101 0:cbe368f18aeb 4 void write_PWM1(double vit)
Brand101 0:cbe368f18aeb 5 {
Brand101 0:cbe368f18aeb 6
Brand101 0:cbe368f18aeb 7 if(vit < 0.0)
Brand101 0:cbe368f18aeb 8 {
Brand101 0:cbe368f18aeb 9 vit = -vit;
Brand101 0:cbe368f18aeb 10 INA_M1 = 1;
Brand101 0:cbe368f18aeb 11 INB_M1 = 0;
Brand101 0:cbe368f18aeb 12 }
Brand101 0:cbe368f18aeb 13 else
Brand101 0:cbe368f18aeb 14 {
Brand101 0:cbe368f18aeb 15 INA_M1 = 0;
Brand101 0:cbe368f18aeb 16 INB_M1 = 1;
Brand101 0:cbe368f18aeb 17 }
Brand101 0:cbe368f18aeb 18
Brand101 0:cbe368f18aeb 19 mot1.write(vit);
Brand101 0:cbe368f18aeb 20 test1++;
Brand101 0:cbe368f18aeb 21 }
Brand101 0:cbe368f18aeb 22
Brand101 0:cbe368f18aeb 23 void write_PWM2(double vit)
Brand101 0:cbe368f18aeb 24 {
Brand101 0:cbe368f18aeb 25
Brand101 0:cbe368f18aeb 26 if(vit < 0.0)
Brand101 0:cbe368f18aeb 27 {
Brand101 0:cbe368f18aeb 28
Brand101 0:cbe368f18aeb 29 vit = -vit;
Brand101 0:cbe368f18aeb 30 INA_M2 = 1;
Brand101 0:cbe368f18aeb 31 INB_M2 = 0;
Brand101 0:cbe368f18aeb 32
Brand101 0:cbe368f18aeb 33 }
Brand101 0:cbe368f18aeb 34 else
Brand101 0:cbe368f18aeb 35 {
Brand101 0:cbe368f18aeb 36 INA_M2 = 0;
Brand101 0:cbe368f18aeb 37 INB_M2 = 1;
Brand101 0:cbe368f18aeb 38 }
Brand101 0:cbe368f18aeb 39
Brand101 0:cbe368f18aeb 40 mot2.write(vit);
Brand101 0:cbe368f18aeb 41 test2++;
Brand101 0:cbe368f18aeb 42 }