
Hertz Controle
Dependencies: USBDevice USBHost mbed
Revision 0:82ac305b273e, committed 2018-04-15
- Comitter:
- ABuche
- Date:
- Sun Apr 15 17:11:14 2018 +0000
- Commit message:
- Initial Commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Sun Apr 15 17:11:14 2018 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_official/code/USBDevice/#53949e6131f6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBHost.lib Sun Apr 15 17:11:14 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBHost/#7c3b59bb364e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Apr 15 17:11:14 2018 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "USBHostSerial.h" + +DigitalOut led(LED1); +Serial pc(USBTX, USBRX); + +void serial_task(void const*) { + USBHostSerial serial; + + while(1) { + + // try to connect a serial device + while(!serial.connect()) + Thread::wait(500); + + // in a loop, print all characters received + // if the device is disconnected, we try to connect it again + while (1) { + + // if device disconnected, try to connect it again + if (!serial.connected()) + break; + + // print characters received + while (serial.available()) { + printf("%c", serial.getc()); + } + + Thread::wait(50); + } + } +} + +int main() { + Thread serialTask(serial_task, NULL, osPriorityNormal, 256 * 4); + while(1) { + led=!led; + Thread::wait(500); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Apr 15 17:11:14 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/994bdf8177cb \ No newline at end of file