![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
s
Dependencies: LM75B C12832_lcd LCD_fonts
main.cpp
- Committer:
- an3
- Date:
- 2020-01-07
- Revision:
- 3:1d052bd266c6
- Parent:
- 2:b4a812174f7e
File content as of revision 3:1d052bd266c6:
#include "mbed.h" #include "LM75B.h" #include "C12832_lcd.h" DigitalOut myled(LED2); Serial pc(USBTX, USBRX); Thread led_thread; Thread low_time_thread; Thread high_time_thread; Mutex verMutex; //Nr.5 weiss nicht wo es bei meiner Variante hinkäme int ton = 0.5; int toff = 0.5; void ledThread() { while(1) { myled=1; wait(ton); myled=0; wait(toff); } } } hightime() { while( (eingabe!='R')&&(eingabe!='L') ) { eingabe = pc.getc(); if(eingabe=='+'){ ton+=0.1;} if(eingabe=='-'){ ton-=0.1;} if(ton>=2) {ton=2.0;} if(ton<=0.1){ton=0.1;} } } lowtime() { while( (eingabe!='R')&&eingabe!='L') ) { eingabe = pc.getc(); if(eingabe=='+'){ toff+=0.1;} if(eingabe=='-'){ toff-=0.1;} if(toff>=2) {toff=2.0;} if(toff<=0.1){toff=0.1;} } } int main() { led_thread.start(ledThread); //thread pc.printf("Helligkeit:auswählen H-leuchtzeit, L-Dunkelzeit, R-reset"); eingabe = pc.getc(); while(1) { if(eingabe == 'R'){ ton=toff=0.5; } if(eingabe == 'H'){ pc.printf("+ für 0.1sek mehr, - für weniger"); high_time_thread.start(hightime); } if(eingabe == 'L'){ pc.printf("+ für 0.1sek mehr, - für weniger"); low_time_thread.start(lowtime); } } }