using DAC0_OUT to adjust the brightness of a led

Committer:
dshin
Date:
Sun Mar 29 19:41:28 2020 +0000
Revision:
0:f31836d48420
Child:
1:aa352db03d0c
mbed-os-5-14-2-empty

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dshin 0:f31836d48420 1 #include "mbed.h"
dshin 0:f31836d48420 2
dshin 0:f31836d48420 3 // https://os.mbed.com/docs/mbed-os/v5.15/tools/creating-a-new-program.html
dshin 0:f31836d48420 4
dshin 0:f31836d48420 5 Serial pc(USBTX, USBRX, 115200); // baud rate 115200
dshin 0:f31836d48420 6 DigitalOut led(LED1); // led = LED1
dshin 0:f31836d48420 7
dshin 0:f31836d48420 8 int main()
dshin 0:f31836d48420 9 {
dshin 0:f31836d48420 10 while (true) {
dshin 0:f31836d48420 11 led = 0;
dshin 0:f31836d48420 12 printf("LED1 is ON\r\n");
dshin 0:f31836d48420 13 thread_sleep_for(500);
dshin 0:f31836d48420 14 led = 1;
dshin 0:f31836d48420 15 printf("LED1 is OFF\r\n");
dshin 0:f31836d48420 16 thread_sleep_for(500);
dshin 0:f31836d48420 17 }
dshin 0:f31836d48420 18 }