Takemasa Nakamura
/
pwmLED
LED control by PWM.
main.cpp
- Committer:
- suikan
- Date:
- 2010-10-17
- Revision:
- 0:b3a395ee08f3
File content as of revision 0:b3a395ee08f3:
/** * \file main.cpp * \brief main program */ #include "mbed.h" #include "math.h" // Blink the LED smoothly with PWM. // Also, this project is test of the math function. /** * \brief LED to control */ PwmOut myled(LED1); /** * \brief main program */ int main() { myled.period_ms( 1 ); while (1) for ( int i=0; i<360; i+=10 ) { myled = cos( i*2.0*3.14/360 ) * 0.5 + 0.5; wait(0.03); } }