![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Dimmerschaltung für Lab_2
Dependencies: C12832_lcd LCD_fonts mbed
main.cpp
- Committer:
- Shadow
- Date:
- 2013-04-23
- Revision:
- 0:ba26f4fa04ca
- Child:
- 1:abdbb6ca745b
File content as of revision 0:ba26f4fa04ca:
#include "mbed.h" #include "C12832_lcd.h" #include "Arial_9.h" C12832_LCD lcd; DigitalIn t_left(p13); DigitalIn t_right(p16); DigitalIn t_on_off(p14); PwmOut led(LED1); //DigitalOut ledright(LED4); double i=0.0; int main() { lcd.cls(); lcd.set_font((unsigned char*) Arial_9); led=0.0; while (1) { while(t_right&&i<=1.0){ lcd.printf("DIMM %lf\n",i); lcd.printf("LED %lf\n",led); i+=0.01; led=i; wait(0.1); if(!t_right){ led=i; lcd.printf("DIMM %lf\n",i); lcd.printf("LED %lf\n",led); } } while(t_left&&i>=0.0){ lcd.printf("DIMM %lf\n",i); lcd.printf("LED %lf\n",led); i-=0.01; led=i; wait(0.1); if(!t_left){ led=i; lcd.printf("DIMM %lf\n",i); lcd.printf("LED %lf\n",led); } } } }