lololololol

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

main.cpp

Committer:
Hendrikvg
Date:
2019-09-14
Revision:
7:d307e31f7391
Parent:
6:61618bf71a08
Child:
8:d1794f225fff

File content as of revision 7:d307e31f7391:

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

MODSERIAL pc(USBTX, USBRX);
DigitalOut ledr(LED_RED);

class Counter
{
public:
    Counter(PinName pin) : _interrupt(pin)          // create the InterruptIn on the pin specified to Counter
    {
        _interrupt.rise(callback(this, &Counter::increment)); // attach increment function of this counter instance
    }

    void increment()
    {
        _count++;
    }

    int read()
    {
        return _count;
    }
};

Counter counter(SW2);

int main()
{
    pc.baud(115200);
    while(1) {
        if _
        printf("Count so far: %d\n\r", counter.read());
        wait(2);
    }
}