hhh

Dependencies:   mbed

Committer:
ee12b079
Date:
Fri Jul 04 19:00:58 2014 +0000
Revision:
0:7b7e8b116cad
j;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ee12b079 0:7b7e8b116cad 1 //This program shows that when serial connection is enabled;
ee12b079 0:7b7e8b116cad 2 //the bits written stay on the serial bus on the pc-end ,
ee12b079 0:7b7e8b116cad 3 //while reading them from serial bus those bits get redsed first
ee12b079 0:7b7e8b116cad 4
ee12b079 0:7b7e8b116cad 5
ee12b079 0:7b7e8b116cad 6 #include "mbed.h"
ee12b079 0:7b7e8b116cad 7 Serial pc(USBTX, USBRX); // tx, rx
ee12b079 0:7b7e8b116cad 8
ee12b079 0:7b7e8b116cad 9 main()
ee12b079 0:7b7e8b116cad 10 {
ee12b079 0:7b7e8b116cad 11 while(1)
ee12b079 0:7b7e8b116cad 12 {
ee12b079 0:7b7e8b116cad 13 if(pc.readable()>0)
ee12b079 0:7b7e8b116cad 14 {
ee12b079 0:7b7e8b116cad 15 char input = pc.getc();
ee12b079 0:7b7e8b116cad 16 for(int i=0;i<100;i++)
ee12b079 0:7b7e8b116cad 17 pc.putc(input);
ee12b079 0:7b7e8b116cad 18 }
ee12b079 0:7b7e8b116cad 19
ee12b079 0:7b7e8b116cad 20 for (int i=0; i<10;i++)
ee12b079 0:7b7e8b116cad 21 printf("%d",i);
ee12b079 0:7b7e8b116cad 22
ee12b079 0:7b7e8b116cad 23 wait(2);
ee12b079 0:7b7e8b116cad 24 }
ee12b079 0:7b7e8b116cad 25 }
ee12b079 0:7b7e8b116cad 26
ee12b079 0:7b7e8b116cad 27
ee12b079 0:7b7e8b116cad 28
ee12b079 0:7b7e8b116cad 29