Motor class working

Dependencies:   QEI biquadFilter mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "Motor.h"
00002 Ticker tick;
00003 Ticker tack;
00004 DigitalIn a(D2);
00005 DigitalIn b(D3);
00006 Motor motor;
00007 
00008 void ticker()
00009 {
00010      motor.Motor::set_angle();
00011      motor.Motor::set_velocity();
00012       
00013 }
00014 void tock(){
00015     
00016      if(a==0){
00017             motor.control_velocity(0.8);}
00018         else{
00019             motor.control_velocity(0);}
00020             
00021         if(b==0){
00022             motor.change_direction();}
00023     
00024 }
00025 
00026 
00027 int main()
00028 {
00029     
00030     tack.attach(&tock, 0.2);
00031     tick.attach(&ticker, 0.01);
00032     
00033     
00034   
00035     
00036 }