br g5

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

main.cpp

Committer:
boydmartherus
Date:
2019-09-20
Revision:
8:b2e57b815f68
Parent:
6:c2608dedfd70

File content as of revision 8:b2e57b815f68:

#include "mbed.h"
#include "MODSERIAL.h";
#include "FastPWM.h" ;
#include "QEI.h";

Serial pc(USBTX,USBRX);

// motor control
AnalogIn pot(PTB2);
FastPWM motor(D5);

//  Encoding
int pulses = 131;
QEI wheel (D13,D12,NC, pulses);


int main()
{ 
    while(1){
        wait(0.1);
        printf("motor relative speed is (%f)\n\r",pot.read()); 
        wait(0.1);
        motor.write(pot); 
        }
    while(true){
        wait(0.1);
        pc.printf("Pulses is: %i\n", wheel.getPulses()); 
        wait(0.1);
}