fork 1

Dependencies:   mbed

Fork of eic_blinky_interrupt by 尚人 永井

main.cpp

Committer:
Naoto_111
Date:
2014-05-14
Revision:
0:866573259a54
Child:
1:47e9b18377b9

File content as of revision 0:866573259a54:

#include "mbed.h"

Serial pc(USBTX,USBRX);//tx,rx
AnalogOut led_y(p18);

void pc_rx();

int main()
{
    pc.attach(&pc_rx,Serial::RxIrq);
    while(1) {
        sleep();
    }
}

void pc_rx ()
{
    char buff=pc.getc();
    if('0'<=buff&&buff<='9')
    {
        float a=(buff-'0'+1)*0.1;//buff=='0'->a=0.1  buff=='9'->a=1.0
        led_y=a;
        pc.printf("led_y=%f\r\n",a);
    }
        
}