statemachine

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

main.cpp

Committer:
boydmartherus
Date:
2019-09-23
Revision:
16:0ff43ed4d259
Parent:
10:9101c7a4f219
Child:
17:3751c2c685ca

File content as of revision 16:0ff43ed4d259:

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

Serial pc(USBTX,USBRX);

AnalogIn pot(PTB2);
InteruptIn button(PTB3)

FastPWM led(PTA1);
FastPWM motor(D5);
DigitalOut direction(D4);

int pulses = 4200;
QEI wheel (D13,D12,NC,pulses);

int main()
{ 
    printf("Control with dial\n");
        while(true)
            {
                wait(0.1);
                printf("motor speeed is (%f)\n\r",pot.read());
                wait(0.1);
                led.write(pot);
                wait(0.1);
                motor.write(pot);
                wait(0.1);
                printf("pulse number is (%i)\n\r",wheel.getPulses());
            }
}