Tatsuki Fukuda
/
eic_brinky
first mbed project
Revision 3:5eff3b204d89, committed 2014-05-14
- Comitter:
- Naoto_111
- Date:
- Wed May 14 08:01:22 2014 +0000
- Parent:
- 2:3c83ffc5a61a
- Commit message:
- use analogout
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3c83ffc5a61a -r 5eff3b204d89 main.cpp --- a/main.cpp Tue May 13 15:52:46 2014 +0000 +++ b/main.cpp Wed May 14 08:01:22 2014 +0000 @@ -2,14 +2,18 @@ DigitalOut led[]= {LED1,LED2,LED3,LED4,LED3,LED2}; Serial pc(USBTX,USBRX);//tx,rx - +AnalogOut led_y(p18); +float f(int i) +{ + return i<4 ? (int)(3.3*i+0.5)/10.0 : (10-(int)(3.3*(i-3)+0.5))/10.0; +} int main() { - pc.printf("LikWeeDayo"); while(1) { for(int i=0; i<6; i=1+i) { led[i]=0; + led_y=f(i); led[(i+1)%6]=1; pc.printf("led[%d] is ON\r\n",(i+1)%6); wait(0.2);