Übungen zur RGB-LED

Dependencies:   mbed

Revision:
1:1f8c1c63e73a
Parent:
0:7a7d5bc16807
Child:
2:b57e33335e5e
--- a/main.cpp	Sat Jan 11 10:23:29 2020 +0000
+++ b/main.cpp	Sat Jan 11 10:29:14 2020 +0000
@@ -13,8 +13,8 @@
 Ticker t1;
 Ticker t_ledStrip;
 
-void LedR();
-void timeCounter();
+void LedR();        // Makes the red part of the RGB_LED up to 30% bright
+void timeCounter(); // Counts PWM steps in binary
 
 int main() {
     ledR.period(0.01f);
@@ -22,6 +22,9 @@
     t_ledStrip.attach(callback(&timeCounter), 0.0001f * 10000);
     
 }
+
+// Increases the LED brightness by 1% each step
+// up to 30%
  void LedR()
 {
      ledR.write(ledR.read() + 0.001f);
@@ -30,6 +33,8 @@
          ledR.write(0.0f);
      }
 }
+// Because of the same timelapse this function
+// counts every step of the PWM in a binary system
  void timeCounter()
 {
      if(ledStrip == 0x00 || ledR.read() == 0.0f)