Opzetje

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

motor.cpp

Committer:
Mortimerz
Date:
2019-10-01
Revision:
7:2f612f32711a

File content as of revision 7:2f612f32711a:

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

Serial pc(USBTX,USBRX);

InterruptIn button1(PTC2);
InterruptIn button2(PTC3);
InterruptIn button3(PTA4);
InterruptIn button4(PTC6);

AnalogIn pot(PTB2);

//DigitalOut motor(D5);
FastPWM lampje(D3);
FastPWM motor(D5);
Ticker ticker;


void motor_speed()
{
    float f = pot.read();
    pc.printf("%f\n\r",f);
    motor.write(f);
    lampje.write(f);
}

int main()
{
    ticker.attach(&motor_speed, 0.01f);
    while(true){};
}