Motor class working
Dependencies: QEI biquadFilter mbed
Diff: main.cpp
- Revision:
- 3:9d861827b714
- Parent:
- 1:1a01edf0379c
--- a/main.cpp Fri Oct 13 11:23:04 2017 +0000 +++ b/main.cpp Mon Oct 16 09:29:33 2017 +0000 @@ -1,11 +1,36 @@ -#include "mbed.h" #include "Motor.h" +Ticker tick; +Ticker tack; +DigitalIn a(D2); +DigitalIn b(D3); +Motor motor; + +void ticker() +{ + motor.Motor::set_angle(); + motor.Motor::set_velocity(); + +} +void tock(){ + + if(a==0){ + motor.control_velocity(0.8);} + else{ + motor.control_velocity(0);} + + if(b==0){ + motor.change_direction();} + +} + int main() { - //Motor motor_L(sdfjhas); - // Motor motor_R(); - while (true) { - //Motor::motorL.aply_filter(kasdf , adljfha); - } + + tack.attach(&tock, 0.2); + tick.attach(&ticker, 0.01); + + + + }