Simon Ford
/
Serial2Serial
Simple example of a serial port communicating with another serial port
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 // example showing sending/receiving character 00002 00003 #include "mbed.h" 00004 00005 // connect p9 to p14 with a wire! 00006 Serial out(p9, NC); 00007 Serial in(NC, p14); 00008 00009 DigitalOut led(LED1); 00010 00011 int main() { 00012 out.putc('h'); 00013 out.putc('i'); 00014 char c1 = in.getc(); 00015 char c2 = in.getc(); 00016 00017 led = 1; 00018 printf("c1: %c, c2: %c\n", c1, c2); 00019 }
Generated on Thu Jul 14 2022 01:01:44 by 1.7.2