Alejandro Forero / Mbed 2 deprecated Pwmlatente

Dependencies:   mbed

main.cpp

Committer:
alejandroforero
Date:
2015-12-10
Revision:
0:fd8b7f396f9c

File content as of revision 0:fd8b7f396f9c:

#include "mbed.h"
/* view a PWM in an output with increment and decrement. anode led connected to PWM pin (8-J1 or PTA1 or D3 are equal) and cathode to ground (pin 14-J2)
with 330ohms resistor. */

PwmOut led (D3);
float value =0;

int main(){
    
    while (true) {
       
       for(value=0.0;value<=1.0;value+=0.02){
           led.write(value);
           wait(0.02);
           }
           
       for(value=1.0;value>=0.0;value-=0.02){
           led = value;
           wait(0.02);
           }    
       
       
       
    }
}