Syed Shakeeb Sadiq / Mbed 2 deprecated mbed_serial_display

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002  
00003 Serial pc(USBTX, USBRX);
00004 Serial screen(PB9,PB10);
00005 
00006 DigitalOut pc_activity(LED1);
00007 DigitalOut screen_activity(LED2);
00008  
00009 int main(void) {
00010     screen.baud(9600);
00011     pc.printf("Hello World!\n\r");
00012    
00013     while(1)
00014     {
00015         if(screen.readable()) {
00016             pc.putc(screen.getc());
00017             screen_activity = !screen_activity;
00018         }
00019         
00020         if(pc.readable()) {            
00021 /*
00022             screen.putc(0x01);
00023             screen.putc(0x06);
00024             screen.putc(0x01);
00025             screen.putc(0x00);
00026             screen.putc(0x01);
00027             screen.putc(0x1A);
00028 */
00029             screen.putc(pc.getc());
00030             pc_activity = !pc_activity;
00031         }
00032         
00033     }
00034 }