Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 //#include "pwmled.h" 00004 Ticker systick; 00005 Ticker resetrut; 00006 00007 volatile char bstandby; 00008 PwmOut led(LED1); 00009 DigitalIn hell(p10); 00010 DigitalIn dunk(p11); 00011 TextLCD lcd(p15, p16, p17, p18, p19, p20); 00012 int zahler; 00013 int zahleroff; 00014 00015 //==================================================00 00016 void vTimer(void){ 00017 00018 bstandby =1;} 00019 //==================================== 00020 void reset(void){ 00021 if(hell==0 || dunk==0){ zahler = 0; zahleroff = 0;} 00022 } 00023 //=================================================== 00024 int main() { 00025 float pulsw; 00026 //void (*p)(); 00027 pulsw = 0.5; 00028 zahler =0 ; // Zähler wieviel mal die systemzeit durchgelaufen ist. 00029 zahleroff =0; 00030 bool on=0; 00031 //led = pulsw; 00032 systick.attach(&vTimer, 0.037); 00033 resetrut.attach(&reset, 1); 00034 while(1) { 00035 //============================================0 00036 if(hell){ 00037 00038 if(on){ 00039 if(!dunk){ 00040 lcd.locate(0,0); 00041 lcd.printf("HELL PRESS"); 00042 if(pulsw <= 0.98){ 00043 pulsw+= 0.01; 00044 led = pulsw;} 00045 } 00046 }else{ // EINSCHALTRUTINE !!!!!! 00047 if(dunk){ 00048 if(zahler == 10){on = 1 ; led = pulsw; zahler = 0;} 00049 else zahler +=1; 00050 } 00051 } 00052 } 00053 //===============================================0 00054 if(dunk){ 00055 if(on){ 00056 if(hell){ // ausschaltrutine !!!!! 00057 if(zahleroff == 10 ){ on = 0; led =0; zahleroff = 0;} 00058 else zahleroff +=1; 00059 }else{ 00060 lcd.locate(0,0); 00061 lcd.printf("DUNK PRESS"); 00062 if(pulsw >= 0.02){ 00063 pulsw -= 0.01; 00064 led = pulsw; 00065 } 00066 } 00067 } 00068 } 00069 //==================================================== 00070 // lcd.cls(); 00071 lcd.locate(0,1); 00072 lcd.printf("%f",pulsw); 00073 lcd.locate(9,1); 00074 lcd.printf("%d",zahler); 00075 lcd.locate(13,1); 00076 lcd.printf("%d",zahleroff); 00077 while(bstandby == 0) {}; 00078 bstandby = 0; 00079 } 00080 }
Generated on Sat Aug 13 2022 00:40:39 by
1.7.2