080_LED_UserButton_PWM

Files at this revision

API Documentation at this revision

Comitter:
itbusch
Date:
Fri Feb 04 09:19:23 2022 +0000
Parent:
0:ebd8e92b9d80
Commit message:
080_LED_SOS_UP_Strukturen_UserButton_PWM

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ebd8e92b9d80 -r 2d785f9b9879 main.cpp
--- a/main.cpp	Mon Jan 31 16:59:13 2022 +0000
+++ b/main.cpp	Fri Feb 04 09:19:23 2022 +0000
@@ -1,23 +1,23 @@
-/* mbed BuschA
- */
+/* mbed BuschA*/
 
 #include "mbed.h"
 
-AnalogOut Boardled(LED1);           //PWM!
-DigitalIn CableSwitch(D2); //PullUp auf Board, PA_10
+PwmOut Boardled(LED1);           //PWM!
+DigitalIn User_Button(PC_13); //PullUp auf Board, PC13
 
 int main()
 {
-
-    while (1) 
+    Boardled.period_ms(10); //PWM-Periodendauer
+    
+    while (true) 
     {
-    if (CableSwitch == false)
+        if (User_Button == false)
         {
-        Boardled = 8;
+        Boardled = 0.2;      //PWM Tastgrad 0-1
         }
     else
         {
-        Boardled = 255;
+        Boardled = 1.0;      //PWM Tastgrad 0-1
         }
     }
 }
\ No newline at end of file