lololololol

Dependencies:   mbed QEI HIDScope biquadFilter MODSERIAL FastPWM

main.cpp

Committer:
Hendrikvg
Date:
2019-09-19
Revision:
9:12b9865e7373
Parent:
8:d1794f225fff
Child:
10:3a3d6373b41c
Child:
14:20f11bb58244

File content as of revision 9:12b9865e7373:

#include "mbed.h"

Serial pc(USBTX,USBRX);
InterruptIn BUT1(D1);
InterruptIn BUT2(D0);
PwmOut lichtje(D3);
AnalogIn   ain(A0);

float getal;
int n=5;

void plus()
{
    n++; // n=n+1
    if (n>10){
        n=10;
        }
    }
    
void min()
{
    n--;
    if (n<0){
        n=0;
        }
    }

int main() {
    pc.baud(115200);
    lichtje=1;
    BUT1.fall(plus);
    BUT2.fall(min);
        while(true)
            {
                    getal = 0.01*n*ain.read();
                   lichtje.period(4.0f);  // 4 second period
                    lichtje.write(getal);  // duty cycle
                    pc.printf("%3.3f%\n\r", ain.read());
        
    }
}