LAB07 Oppgave 4 Template
Dependencies: mbed
main.cpp
- Committer:
- rlanghbv
- Date:
- 2015-10-14
- Revision:
- 0:ce0d1043321f
File content as of revision 0:ce0d1043321f:
#include "mbed.h" Timeout onTime; Ticker periodTimer; DigitalOut led(PA_9); float periodTime=0.020; // 20ms period time (50Hz) float dutyCycle=.05; void TurnLightOff() { led=1; } void TurnLightOn() { led=0; onTime.attach(&TurnLightOff,(float)periodTime*dutyCycle); } int main() { periodTimer.attach(&TurnLightOn,periodTime); while(1) { wait(1); } }