Sz_Insper / Mbed 2 deprecated Null_Kreuzung

Dependencies:   mbed

main.cpp

Committer:
henriquer
Date:
2020-09-16
Revision:
0:0faa3d26e55e
Child:
1:6192e5b45a58

File content as of revision 0:0faa3d26e55e:

# include "mbed.h"

AnalogIn pot(A0);
InterruptIn Pulso(D7);
DigitalOut scr   (D8);
Serial pc(USBTX,USBRX);


int temp = 0;
float analog ;
int angle = 0;


void interrupt ()
{
    for (int i = 0; i<temp; i++) {


        scr = 1;
        wait_us(temp);
        scr = 0;
        //wait(1);


    }

}



int main()
{

    Pulso.rise(&interrupt);

    while(1) {

        analog = pot;


        temp = (analog*45); // angulo
        pc.printf("\n\r%1.3f ",analog);
        wait(0.5);
        temp =0;


    }

}