Lehrer Busch
/
080_LED_SOS_UP_Strukturen_UserButton_PWM
080_LED_SOS_UP_Strukturen_UserButton_PWM
Diff: main.cpp
- Revision:
- 1:2d785f9b9879
- Parent:
- 0:ebd8e92b9d80
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