teste com PWM - aula 02/05/2016

Dependencies:   mbed

Committer:
guilhermepaulino
Date:
Mon May 02 18:09:10 2016 +0000
Revision:
0:b57d71e51a71
teste PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
guilhermepaulino 0:b57d71e51a71 1 #include "mbed.h"
guilhermepaulino 0:b57d71e51a71 2 PwmOut ledr(LED1);
guilhermepaulino 0:b57d71e51a71 3 PwmOut ledg(LED2);
guilhermepaulino 0:b57d71e51a71 4 PwmOut ledb(LED3);
guilhermepaulino 0:b57d71e51a71 5
guilhermepaulino 0:b57d71e51a71 6 int main(){
guilhermepaulino 0:b57d71e51a71 7 float p;
guilhermepaulino 0:b57d71e51a71 8 while(1){
guilhermepaulino 0:b57d71e51a71 9 ledr=1;
guilhermepaulino 0:b57d71e51a71 10 ledg=1;
guilhermepaulino 0:b57d71e51a71 11 ledb=1;
guilhermepaulino 0:b57d71e51a71 12 for(p=0.0f; p < 0.33f; p += 0.01f){
guilhermepaulino 0:b57d71e51a71 13 ledg=p;
guilhermepaulino 0:b57d71e51a71 14 wait(0.02);
guilhermepaulino 0:b57d71e51a71 15 }
guilhermepaulino 0:b57d71e51a71 16 ledg=1;
guilhermepaulino 0:b57d71e51a71 17 for(p=0.33f; p < 0.66f; p += 0.01f){
guilhermepaulino 0:b57d71e51a71 18 ledr=p;
guilhermepaulino 0:b57d71e51a71 19 wait(0.02);
guilhermepaulino 0:b57d71e51a71 20 }
guilhermepaulino 0:b57d71e51a71 21 ledr=1;
guilhermepaulino 0:b57d71e51a71 22 for(p=0.66f; p <= 1.0f; p += 0.01f){
guilhermepaulino 0:b57d71e51a71 23 ledb=p;
guilhermepaulino 0:b57d71e51a71 24 wait(0.02);
guilhermepaulino 0:b57d71e51a71 25 }
guilhermepaulino 0:b57d71e51a71 26 }
guilhermepaulino 0:b57d71e51a71 27 }