LAB07 Oppgave 4 Template
Dependencies: mbed
Revision 0:ce0d1043321f, committed 2015-10-14
- Comitter:
- rlanghbv
- Date:
- Wed Oct 14 19:06:20 2015 +0000
- Commit message:
- first commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r ce0d1043321f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 14 19:06:20 2015 +0000 @@ -0,0 +1,26 @@ +#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); + } +}
diff -r 000000000000 -r ce0d1043321f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 14 19:06:20 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file