Created
January 25, 2019 10:51
-
-
Save allfake/a138cb9d3b22399a917c1bf6b87641fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* mbed Microcontroller Library | |
* Copyright (c) 2018 ARM Limited | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
#include "mbed.h" | |
#include "stats_report.h" | |
DigitalOut led1(LED1); | |
#define SLEEP_TIME 2000 // (msec) | |
#define PRINT_AFTER_N_LOOPS 20 | |
// main() runs in its own thread in the OS | |
int main() | |
{ | |
RawSerial serial(P0_6, P0_8, 9600); | |
serial.set_flow_control(SerialBase::RTSCTS, P0_5, P0_7); | |
while (true) { | |
if (serial.readable()) { | |
char c = serial.getc(); | |
serial.putc(c); | |
led1 = 1; | |
serial.printf("%c\n",c); | |
} | |
else | |
{ | |
led1 = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment