Juvo Labs / Mbed 2 deprecated mDot_Serial_Example

Dependencies:   mbed

Fork of mDot_Serial_Example by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /** mDot Serial Example Program
00002  *
00003  * This program demonstrates how to do handle a serial port
00004  * using the MultiTech mDot and MultiTech UDK2 hardware.
00005  *
00006  * This program echos characters on the debug serial port.
00007  * The debug serial port is operated at the default baud, 9600.
00008  * Connect your terminal application to the appropriate COM/tty
00009  * port on your PC. See https://developer.mbed.org/handbook/SerialPC
00010  * for details.
00011  */
00012  
00013 #include "mbed.h"
00014 #include <string>
00015 
00016 
00017  
00018  //Serial pc(USBTX, USBRX);
00019  
00020  //Serial pc(PA_2, PA_3);
00021  
00022  Serial pc(USBTX, USBRX);
00023 
00024 Serial device(PA_2, PA_3);  // tx, rx
00025 
00026 int main() {
00027     device.baud(9600);
00028     while(1) {
00029         /*(pc.readable()) {
00030             device.putc(pc.getc());
00031             
00032         }*/
00033         
00034        
00035         
00036         //delay(500);
00037         if(device.readable()) {
00038              pc.putc('h');
00039              pc.putc('\r');
00040            // pc.putc(device.getc());
00041         }
00042     }
00043 }
00044  
00045  
00046