Ultraschall Test Geschwindigkeitsregelung
Fork of BertlLib by
Diff: Bertl14.cpp
- Revision:
- 7:01d2bc098b6d
- Parent:
- 6:78243412d2b3
--- a/Bertl14.cpp Thu Mar 05 17:39:16 2015 +0000 +++ b/Bertl14.cpp Mon Apr 25 06:55:29 2016 +0000 @@ -2,41 +2,6 @@ #include "mbed.h" #include "Bertl14.h" -Motor::Motor(PinName pwm, PinName fwd, PinName rev) : -_pwm(pwm), _fwd(fwd), _rev(rev) -{ - _pwm.period(0.001); _pwm=0; - _fwd=0; _rev=0; -} - -void Motor::SetPow(float aPow) -{ - if( aPow>=0.0 ) { - _fwd=1; _rev=0; - _pwm = aPow; - } - else { - _fwd=0; _rev=1; - _pwm = -aPow; - } -} - -BertlDrive::BertlDrive(PinName pwm, PinName fwd, PinName rev, PinName encoder) : -Motor(pwm,fwd,rev) , _enc(encoder) -{ - encCnt = 0; -} - -void BertlDrive::Init() -{ - _enc.rise(this, &BertlDrive::EncoderISR); - _enc.fall(this, &BertlDrive::EncoderISR); -} - -void BertlDrive::EncoderISR() -{ - encCnt++; -} PortEx::PortEx() :