ff snel plz
Dependencies: FastPWM MODSERIAL mbed
Fork of Week3_Assignment1 by
main.cpp@2:4b07b20b8476, 2018-09-21 (annotated)
- Committer:
- EvaKrolis
- Date:
- Fri Sep 21 10:22:20 2018 +0000
- Revision:
- 2:4b07b20b8476
- Parent:
- 0:1ce2f25401f0
- Child:
- 3:f9ac37cdfa50
Alsjeblieft Ramon
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EvaKrolis | 2:4b07b20b8476 | 1 | #include "mbed.h" |
EvaKrolis | 2:4b07b20b8476 | 2 | #include "FastPWM.h" |
EvaKrolis | 2:4b07b20b8476 | 3 | |
EvaKrolis | 2:4b07b20b8476 | 4 | FastPWM led1(D9); |
EvaKrolis | 2:4b07b20b8476 | 5 | int frequency_pwm = 10000; |
EvaKrolis | 2:4b07b20b8476 | 6 | InterruptIn button1(D1); |
EvaKrolis | 2:4b07b20b8476 | 7 | InterruptIn button2(D2); |
EvaKrolis | 2:4b07b20b8476 | 8 | |
EvaKrolis | 2:4b07b20b8476 | 9 | void brightness() |
EvaKrolis | 2:4b07b20b8476 | 10 | { |
EvaKrolis | 2:4b07b20b8476 | 11 | if (button1 == 1) |
EvaKrolis | 2:4b07b20b8476 | 12 | { |
EvaKrolis | 2:4b07b20b8476 | 13 | led1.write(1); |
EvaKrolis | 2:4b07b20b8476 | 14 | } |
EvaKrolis | 2:4b07b20b8476 | 15 | } |
EvaKrolis | 2:4b07b20b8476 | 16 | |
EvaKrolis | 2:4b07b20b8476 | 17 | int main() |
EvaKrolis | 2:4b07b20b8476 | 18 | { |
EvaKrolis | 2:4b07b20b8476 | 19 | led1.period(1.0/frequency_pwm); |
EvaKrolis | 2:4b07b20b8476 | 20 | //button1.rise(brightness); |
EvaKrolis | 2:4b07b20b8476 | 21 | |
EvaKrolis | 2:4b07b20b8476 | 22 | while (true) |
EvaKrolis | 2:4b07b20b8476 | 23 | { |
EvaKrolis | 2:4b07b20b8476 | 24 | led1.write(0.01); |
EvaKrolis | 2:4b07b20b8476 | 25 | button1.rise(brightness); |
EvaKrolis | 2:4b07b20b8476 | 26 | } |
EvaKrolis | 2:4b07b20b8476 | 27 | } |