example serial

Dependencies:   mbed

Fork of mDot_Serial_Example by MultiTech

main.cpp

Committer:
naushadRahman
Date:
2017-01-24
Revision:
2:d98cfa3851de
Parent:
1:d2ee7143632f

File content as of revision 2:d98cfa3851de:

/** mDot Serial Example Program
 *
 * This program demonstrates how to do handle a serial port
 * using the MultiTech mDot and MultiTech UDK2 hardware.
 *
 * This program echos characters on the debug serial port.
 * The debug serial port is operated at the default baud, 9600.
 * Connect your terminal application to the appropriate COM/tty
 * port on your PC. See https://developer.mbed.org/handbook/SerialPC
 * for details.
 */
 
#include "mbed.h"
#include <string>


 
 //Serial pc(USBTX, USBRX);
 
 //Serial pc(PA_2, PA_3);
 
 Serial pc(USBTX, USBRX);

Serial device(PA_2, PA_3);  // tx, rx

int main() {
    device.baud(9600);
    while(1) {
        /*(pc.readable()) {
            device.putc(pc.getc());
            
        }*/
        
       
        
        //delay(500);
        if(device.readable()) {
             pc.putc('h');
             pc.putc('\r');
           // pc.putc(device.getc());
        }
    }
}