teste com PWM - aula 02/05/2016

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
guilhermepaulino
Date:
Mon May 02 18:09:10 2016 +0000
Commit message:
teste 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 02 18:09:10 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+PwmOut ledr(LED1);
+PwmOut ledg(LED2);
+PwmOut ledb(LED3);
+
+int main(){
+    float p;
+    while(1){
+        ledr=1;
+        ledg=1;
+        ledb=1;
+        for(p=0.0f; p < 0.33f; p += 0.01f){
+            ledg=p;
+            wait(0.02);
+        }
+        ledg=1;
+        for(p=0.33f; p < 0.66f; p += 0.01f){
+            ledr=p;
+            wait(0.02);
+        }
+        ledr=1;
+        for(p=0.66f; p <= 1.0f; p += 0.01f){
+            ledb=p;
+            wait(0.02);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 02 18:09:10 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb
\ No newline at end of file