Used in class for algorithm development NMHU. Looking at the behavior of the PWM class
Fork of blink_kl46z by
main.cpp
- Committer:
- scohennm
- Date:
- 2014-09-03
- Revision:
- 1:24090ed5f981
- Parent:
- 0:e23fffd4b9a7
File content as of revision 1:24090ed5f981:
#include "mbed.h" #define LEDON false #define LEDOFF true #define PWMDWELL 50// milliseconds #define DFDELTA 0.01 // slightly more interesting blinky 140814 sc // Change to use PWM float dutyFactor = 0.0; PwmOut greenColor(LED_GREEN); PwmOut redColor(LED_RED); int main() { while(true) { redColor.write(dutyFactor); greenColor.write(1.0 - dutyFactor); dutyFactor += DFDELTA; if(dutyFactor >= 1.0) dutyFactor = 0.0; wait_ms(PWMDWELL); } }