Intensidad_Led

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
fpachays
Date:
Sat Feb 08 02:48:22 2020 +0000
Commit message:
UPS_Maestria_pwm

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 5248e12b2868 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 08 02:48:22 2020 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+Serial pc(PA_2, PA_3,115200); //tx, rx
+PwmOut led(PA_0);
+float brightness=0.0;
+
+int main()
+{
+    pc.printf("control of LED dimmer by host terminal\n\r");
+    pc.printf("Press 'u' = brighter, 'd' = dimmer\n\r");
+    while (1) {
+        char c = pc.getc();
+        wait(0.001);
+        if((c == 'u') && (brightness < 1)) {
+            brightness += 0.1;
+            motor= brightness;
+        }
+        if(( c == 'd') && (brightness > 0)) {
+            brightness -= 0.1;
+            motor = brightness;
+        }
+
+        pc.printf("%c %1.3f \n \r",c,brightness);
+
+    }
+}
+
diff -r 000000000000 -r 5248e12b2868 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Feb 08 02:48:22 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file