ff snel plz
Dependencies: FastPWM MODSERIAL mbed
Fork of Week3_Assignment1 by
Diff: main.cpp
- Revision:
- 2:4b07b20b8476
- Parent:
- 0:1ce2f25401f0
- Child:
- 3:f9ac37cdfa50
--- 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