uart1-m0

Dependencies:   mbed

Committer:
HarishMekali
Date:
Tue Dec 03 15:23:16 2013 +0000
Revision:
0:cf9ad81599d3
uart

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HarishMekali 0:cf9ad81599d3 1 #include "mbed.h"
HarishMekali 0:cf9ad81599d3 2 Serial pc(USBTX, USBRX);
HarishMekali 0:cf9ad81599d3 3 Serial uart(p9, p10);
HarishMekali 0:cf9ad81599d3 4
HarishMekali 0:cf9ad81599d3 5 BusOut leds(LED1, LED2, LED3, LED4);
HarishMekali 0:cf9ad81599d3 6
HarishMekali 0:cf9ad81599d3 7 int a=0xff,z=0;
HarishMekali 0:cf9ad81599d3 8
HarishMekali 0:cf9ad81599d3 9 int main()
HarishMekali 0:cf9ad81599d3 10 {
HarishMekali 0:cf9ad81599d3 11 while(1)
HarishMekali 0:cf9ad81599d3 12 {
HarishMekali 0:cf9ad81599d3 13
HarishMekali 0:cf9ad81599d3 14 //uart.putc('a');
HarishMekali 0:cf9ad81599d3 15 //uart.printf("Hi BMS");
HarishMekali 0:cf9ad81599d3 16 //uart.puts("Hello");
HarishMekali 0:cf9ad81599d3 17 //uart_activity = !uart_activity;
HarishMekali 0:cf9ad81599d3 18 if(z==0)
HarishMekali 0:cf9ad81599d3 19 {
HarishMekali 0:cf9ad81599d3 20 z=z+1;
HarishMekali 0:cf9ad81599d3 21 leds=a;
HarishMekali 0:cf9ad81599d3 22 wait(2);
HarishMekali 0:cf9ad81599d3 23 a=0;
HarishMekali 0:cf9ad81599d3 24 uart.printf("%d",a);
HarishMekali 0:cf9ad81599d3 25 }
HarishMekali 0:cf9ad81599d3 26
HarishMekali 0:cf9ad81599d3 27 if(uart.readable())
HarishMekali 0:cf9ad81599d3 28 {
HarishMekali 0:cf9ad81599d3 29 a=(int)uart.getc();
HarishMekali 0:cf9ad81599d3 30 a=a+1;
HarishMekali 0:cf9ad81599d3 31 uart.printf("%d",a);
HarishMekali 0:cf9ad81599d3 32 leds=a;
HarishMekali 0:cf9ad81599d3 33 wait(1);
HarishMekali 0:cf9ad81599d3 34 }
HarishMekali 0:cf9ad81599d3 35
HarishMekali 0:cf9ad81599d3 36 }
HarishMekali 0:cf9ad81599d3 37 }