Mbed working as USB-Serial interface using MODSERIAL library. This is working well as interface between CHR-6dm position sensor and its PC soft (AHRSInterface)

Dependencies:   mbed

main.cpp

Committer:
kinemax
Date:
2011-04-15
Revision:
0:a1601df537a8

File content as of revision 0:a1601df537a8:

#include "mbed.h"
#define BAUD 115200
#define TX_PIN p9
#define RX_PIN p10
 
 #include "MODSERIAL.h"
 
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
 DigitalOut led3(LED3);
 DigitalOut led4(LED4);
 
 MODSERIAL pc(USBTX, USBRX);
 
 MODSERIAL uart(TX_PIN, RX_PIN);

 
 int main() 
 {
     pc.baud(BAUD);
     uart.baud(BAUD);
     //pc.printf("Start\n\r");
    
   // Transparent uart<->usb - working !
  while(1)
  {
    if( pc.readable()) 
    {led1=1; led4=0; uart.putc(pc.getc());}
    if( uart.readable()) 
    {led4=1; led1=0; pc.putc(uart.getc());} 
  }
 }