fork 1

Dependencies:   mbed

Fork of eic_blinky_interrupt by 尚人 永井

Committer:
cless_albein
Date:
Tue May 20 11:17:23 2014 +0000
Revision:
1:47e9b18377b9
Parent:
0:866573259a54
Child:
2:ab5ef3f84cd5
sho

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Naoto_111 0:866573259a54 1 #include "mbed.h"
Naoto_111 0:866573259a54 2
Naoto_111 0:866573259a54 3 Serial pc(USBTX,USBRX);//tx,rx
Naoto_111 0:866573259a54 4 AnalogOut led_y(p18);
Naoto_111 0:866573259a54 5
Naoto_111 0:866573259a54 6 void pc_rx();
Naoto_111 0:866573259a54 7
Naoto_111 0:866573259a54 8 int main()
Naoto_111 0:866573259a54 9 {
Naoto_111 0:866573259a54 10 pc.attach(&pc_rx,Serial::RxIrq);
Naoto_111 0:866573259a54 11 while(1) {
Naoto_111 0:866573259a54 12 sleep();
cless_albein 1:47e9b18377b9 13 //pc.printf("wakeup\r\n");
Naoto_111 0:866573259a54 14 }
Naoto_111 0:866573259a54 15 }
Naoto_111 0:866573259a54 16
Naoto_111 0:866573259a54 17 void pc_rx ()
Naoto_111 0:866573259a54 18 {
Naoto_111 0:866573259a54 19 char buff=pc.getc();
cless_albein 1:47e9b18377b9 20 pc.putc(buff);
cless_albein 1:47e9b18377b9 21 if(65<=buff&&buff<='Z') {
cless_albein 1:47e9b18377b9 22 pc.putc(buff+0x20);
cless_albein 1:47e9b18377b9 23 } else if('a'<=buff&&buff<='z') {
cless_albein 1:47e9b18377b9 24 pc.putc(buff-0x20);
Naoto_111 0:866573259a54 25 }
cless_albein 1:47e9b18377b9 26 pc.printf("\r\n");
cless_albein 1:47e9b18377b9 27
cless_albein 1:47e9b18377b9 28
Naoto_111 0:866573259a54 29 }