On board led brightness change

Dependencies:   mbed

Committer:
zatharv
Date:
Fri May 20 07:55:34 2022 +0000
Revision:
0:1e577fb904c0
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zatharv 0:1e577fb904c0 1 // LED brightness control
zatharv 0:1e577fb904c0 2 #include "mbed.h"
zatharv 0:1e577fb904c0 3
zatharv 0:1e577fb904c0 4 PwmOut red(LED1);
zatharv 0:1e577fb904c0 5 PwmOut extled(PTC13);
zatharv 0:1e577fb904c0 6
zatharv 0:1e577fb904c0 7 int main() {
zatharv 0:1e577fb904c0 8 while(1) {
zatharv 0:1e577fb904c0 9 for(float i = 0; i<=1; i+=0.01)
zatharv 0:1e577fb904c0 10 {
zatharv 0:1e577fb904c0 11 red = i;
zatharv 0:1e577fb904c0 12 extled = i;
zatharv 0:1e577fb904c0 13 wait(0.1);
zatharv 0:1e577fb904c0 14 }
zatharv 0:1e577fb904c0 15 for(float i = 1;i>=0;i-=0.01)
zatharv 0:1e577fb904c0 16 {
zatharv 0:1e577fb904c0 17 red = i;
zatharv 0:1e577fb904c0 18 extled = i;
zatharv 0:1e577fb904c0 19 wait(0.1);
zatharv 0:1e577fb904c0 20 }
zatharv 0:1e577fb904c0 21 }
zatharv 0:1e577fb904c0 22 }