Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of hackspace_awesomeness by
main.cpp@2:2537a40d2ac8, 2014-07-12 (annotated)
- Committer:
- tony1tf
- Date:
- Sat Jul 12 15:04:56 2014 +0000
- Revision:
- 2:2537a40d2ac8
- Parent:
- 1:8bd923cbd0e5
- Child:
- 3:8de335bdec0f
pwm ext led for kl25
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| spyclub | 0:1d9ecfc751ca | 1 | #include "mbed.h" |
| tony1tf | 2:2537a40d2ac8 | 2 | // for kl25 external 3 colour LED |
| tony1tf | 2:2537a40d2ac8 | 3 | PwmOut redpwm(D5); |
| tony1tf | 2:2537a40d2ac8 | 4 | PwmOut greenpwm(D6); |
| tony1tf | 2:2537a40d2ac8 | 5 | PwmOut blue(D7) |
| tony1tf | 2:2537a40d2ac8 | 6 | int main() |
| tony1tf | 2:2537a40d2ac8 | 7 | { |
| tony1tf | 2:2537a40d2ac8 | 8 | int i; |
| tony1tf | 2:2537a40d2ac8 | 9 | redpwm.period_ms(10); |
| tony1tf | 2:2537a40d2ac8 | 10 | greenpwm.period_ms(10); |
| tony1tf | 2:2537a40d2ac8 | 11 | bluepwm.period_ms(10); |
| spyclub | 0:1d9ecfc751ca | 12 | |
| spyclub | 0:1d9ecfc751ca | 13 | |
| tony1tf | 2:2537a40d2ac8 | 14 | // printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
| tony1tf | 2:2537a40d2ac8 | 15 | |
| spyclub | 0:1d9ecfc751ca | 16 | while(1) { |
| tony1tf | 2:2537a40d2ac8 | 17 | for (i=0; i<11; i++) { |
| tony1tf | 2:2537a40d2ac8 | 18 | redpwm.pulsewidth_ms(i); |
| tony1tf | 2:2537a40d2ac8 | 19 | wait(0.1); |
| tony1tf | 2:2537a40d2ac8 | 20 | } |
| tony1tf | 2:2537a40d2ac8 | 21 | for (i=0; i<11; i++) { |
| tony1tf | 2:2537a40d2ac8 | 22 | greenpwm.pulsewidth_ms(i); |
| tony1tf | 2:2537a40d2ac8 | 23 | wait(0.1); |
| tony1tf | 2:2537a40d2ac8 | 24 | } |
| tony1tf | 2:2537a40d2ac8 | 25 | for (i=0; i<11; i++) { |
| tony1tf | 2:2537a40d2ac8 | 26 | bluepwm.pulsewidth_ms(i); |
| tony1tf | 2:2537a40d2ac8 | 27 | wait(0.1); |
| tony1tf | 2:2537a40d2ac8 | 28 | } |
| tony1tf | 2:2537a40d2ac8 | 29 | |
| tony1tf | 2:2537a40d2ac8 | 30 |
