Thomas Cauwelier / Mbed 2 deprecated visible_light_communication

Dependencies:   SoftSerial SDFileSystem mbed wave_player

main.cpp

Committer:
Thomas Cauwelier
Date:
2017-05-03
Revision:
8:4fcc746968b3
Parent:
7:2b99a26e6a43
Child:
9:d95984ce5de9

File content as of revision 8:4fcc746968b3:


#include "mbed.h"
#include "rtos.h"

Serial out(p9, p10); //p9
Serial in(p13, p14); //p14


void receive_uart() {
    while (true){
        if(in.readable()){
            char s[32];
            printf(in.gets(s, 32));
        }else{
            Thread::yield();
        }
    }
}

int main() {
    printf("%s\r\n", "hello, term!");

    Thread thread;
    thread.start(receive_uart);

    while (true){
        while (!out.writeable());
        out.printf("hello, term\r\n");
//        wait(1);
    }

}