080_LED_SOS_UP_Strukturen_UserButton_PWM

Committer:
itbusch
Date:
Fri Feb 04 09:19:23 2022 +0000
Revision:
1:2d785f9b9879
Parent:
0:ebd8e92b9d80
080_LED_SOS_UP_Strukturen_UserButton_PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
itbusch 1:2d785f9b9879 1 /* mbed BuschA*/
itbusch 0:ebd8e92b9d80 2
itbusch 0:ebd8e92b9d80 3 #include "mbed.h"
itbusch 0:ebd8e92b9d80 4
itbusch 1:2d785f9b9879 5 PwmOut Boardled(LED1); //PWM!
itbusch 1:2d785f9b9879 6 DigitalIn User_Button(PC_13); //PullUp auf Board, PC13
itbusch 0:ebd8e92b9d80 7
itbusch 0:ebd8e92b9d80 8 int main()
itbusch 0:ebd8e92b9d80 9 {
itbusch 1:2d785f9b9879 10 Boardled.period_ms(10); //PWM-Periodendauer
itbusch 1:2d785f9b9879 11
itbusch 1:2d785f9b9879 12 while (true)
itbusch 0:ebd8e92b9d80 13 {
itbusch 1:2d785f9b9879 14 if (User_Button == false)
itbusch 0:ebd8e92b9d80 15 {
itbusch 1:2d785f9b9879 16 Boardled = 0.2; //PWM Tastgrad 0-1
itbusch 0:ebd8e92b9d80 17 }
itbusch 0:ebd8e92b9d80 18 else
itbusch 0:ebd8e92b9d80 19 {
itbusch 1:2d785f9b9879 20 Boardled = 1.0; //PWM Tastgrad 0-1
itbusch 0:ebd8e92b9d80 21 }
itbusch 0:ebd8e92b9d80 22 }
itbusch 0:ebd8e92b9d80 23 }