Señales analogicas

Dependencies:   mbed

main.cpp

Committer:
javiervicente
Date:
2020-12-01
Revision:
0:400fbf72c1de

File content as of revision 0:400fbf72c1de:

#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx
AnalogIn senal(A0);


int main()
{
    pc.baud(115200);

    while (true) {
        float tension=senal.read()*3.3;
        pc.printf("Valor voltios %.4f leido flat\n",tension);
        uint16_t datonentero=senal.read_u16();
        tension=(datonentero*3.3)/65536;
        pc.printf("Valor voltios %.4f leido flat\n",tension);
        wait(1.0);
    }
}