Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* 00002 Project: SerialEcho 00003 File: main.cpp 00004 Created by: Dr. C. S. Tritt 00005 Last revised: 1/17/19 (v. 1.0) 00006 00007 Receives serial data from PC to and echos it back, character for character. 00008 00009 Tera Term configurations 00010 Terminal - New-line, Receive LF, Transmit LF 00011 Serial port - Data 8 bit, Parity none, Stop 1 bit, Flow control none. 00012 Baud as specified below. 00013 */ 00014 #include "mbed.h" 00015 00016 Serial pc(USBTX, USBRX, 9600); // Standard to PC via USB channel. 00017 00018 DigitalOut actLED(LED1); // Activity LED. 00019 00020 int main() 00021 { 00022 while (true) { 00023 if (pc.readable()) { 00024 char character = (char) pc.getc(); // Get a char from the PC. 00025 pc.putc(character); // Send it back to the PC. 00026 actLED = !actLED; // Toggle the activity LED. 00027 } 00028 } 00029 }
Generated on Tue Jul 12 2022 21:44:03 by
 1.7.2
 1.7.2