PWM_Modulation LED

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
chrish
Date:
Tue May 14 08:10:57 2013 +0000
Commit message:
Studienleistung2_beta

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 42f712bdf324 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Tue May 14 08:10:57 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
diff -r 000000000000 -r 42f712bdf324 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 14 08:10:57 2013 +0000
@@ -0,0 +1,80 @@
+#include "mbed.h"
+#include "TextLCD.h"
+//#include "pwmled.h"
+Ticker systick;
+Ticker resetrut;
+
+volatile char bstandby;
+PwmOut led(LED1);
+DigitalIn hell(p10);
+DigitalIn dunk(p11);
+TextLCD lcd(p15, p16, p17, p18, p19, p20);
+int zahler;
+int zahleroff;
+
+//==================================================00
+void vTimer(void){
+
+bstandby =1;}
+//====================================
+void reset(void){
+    if(hell==0 || dunk==0){ zahler = 0; zahleroff = 0;}
+}
+//===================================================
+int main() {
+float pulsw;
+//void (*p)();
+pulsw = 0.5;
+zahler =0 ; // Zähler wieviel mal die systemzeit durchgelaufen ist. 
+zahleroff =0;
+bool on=0;
+//led = pulsw;
+ systick.attach(&vTimer, 0.037);
+ resetrut.attach(&reset, 1);
+    while(1) {
+    //============================================0
+    if(hell){
+    
+   if(on){ 
+        if(!dunk){
+        lcd.locate(0,0);
+        lcd.printf("HELL PRESS");
+        if(pulsw <= 0.98){
+            pulsw+= 0.01;
+            led = pulsw;}
+            }
+        }else{                                  // EINSCHALTRUTINE !!!!!!
+            if(dunk){
+            if(zahler == 10){on = 1 ; led = pulsw; zahler = 0;}
+            else zahler +=1;
+            }
+        }
+    }
+    //===============================================0
+    if(dunk){
+    if(on){
+        if(hell){                               // ausschaltrutine !!!!!
+            if(zahleroff == 10 ){ on = 0; led =0; zahleroff = 0;}
+            else zahleroff +=1;
+            }else{
+                 lcd.locate(0,0);
+                 lcd.printf("DUNK PRESS");
+                 if(pulsw >= 0.02){
+                    pulsw -= 0.01;
+                     led = pulsw;
+                        }
+              }
+        }
+    }
+    //====================================================
+ //  lcd.cls();
+ lcd.locate(0,1);
+ lcd.printf("%f",pulsw);
+ lcd.locate(9,1);
+ lcd.printf("%d",zahler);
+ lcd.locate(13,1);
+ lcd.printf("%d",zahleroff);
+     while(bstandby == 0) {};
+     bstandby = 0;
+    }
+}
diff -r 000000000000 -r 42f712bdf324 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 14 08:10:57 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file