Bluetooth mérés program

Fork of RN42-HelloWorld by Chris Styles

main.cpp

Committer:
szabolor
Date:
2013-03-03
Revision:
2:584102a0bf36
Parent:
1:581f6547e8aa
Child:
3:cd566919776e

File content as of revision 2:584102a0bf36:

#include "mbed.h"

Timer timer;
Ticker meres;
AnalogIn an(p15);
Serial rn42(p9,p10);
Serial pc(USBTX, USBRX);
DigitalOut myled(LED1);
int c;

void mfunc() {
    rn42.printf("%d %f\n",timer.read_ms(), an*3.3);
}

int main() {
    rn42.baud(115200);
    pc.baud(460800);
    // mérés elindítása:
    timer.start();
    meres.attach(&mfunc, 0.5);

    // biztosítom, hogy kapjon adatot!
    while (1) {
        while (rn42.readable()) {
            c = rn42.getc();
            pc.putc(c);
        }
    }
}