Assignment 1
Dependencies: MODSERIAL mbed FastPWM
Revision 2:4b07b20b8476, committed 2018-09-21
- Comitter:
- EvaKrolis
- Date:
- Fri Sep 21 10:22:20 2018 +0000
- Parent:
- 1:53b5197011e6
- Commit message:
- Alsjeblieft Ramon
Changed in this revision
FastPWM.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FastPWM.lib Fri Sep 21 10:22:20 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/Sissors/code/FastPWM/#c0b2265cff9c
--- a/main.cpp Tue Sep 18 14:17:31 2018 +0000 +++ b/main.cpp Fri Sep 21 10:22:20 2018 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" +#include "FastPWM.h" + +FastPWM led1(D9); +int frequency_pwm = 10000; +InterruptIn button1(D1); +InterruptIn button2(D2); + +void brightness() +{ + if (button1 == 1) + { + led1.write(1); + } +} + +int main() +{ + led1.period(1.0/frequency_pwm); + //button1.rise(brightness); + + while (true) + { + led1.write(0.01); + button1.rise(brightness); + } +} \ No newline at end of file