for our workshop this afternoon

Dependencies:   mbed

Fork of hackspace_awesomeness by Tony Abbey

Committer:
divyastra
Date:
Sat Jul 12 15:22:02 2014 +0000
Revision:
5:80b4f48cd3db
Parent:
4:c4dbac2f3e48
Included debug terminal outputs

Who changed what in which revision?

UserRevisionLine numberNew 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);
spyclub 4:c4dbac2f3e48 5 PwmOut bluepwm(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
divyastra 5:80b4f48cd3db 14
spyclub 0:1d9ecfc751ca 15 while(1) {
tony1tf 2:2537a40d2ac8 16 for (i=0; i<11; i++) {
tony1tf 2:2537a40d2ac8 17 redpwm.pulsewidth_ms(i);
divyastra 5:80b4f48cd3db 18 printf("redpwm set to %.2f %%\n", redpwm.read() * 100);
divyastra 5:80b4f48cd3db 19
tony1tf 2:2537a40d2ac8 20 wait(0.1);
tony1tf 2:2537a40d2ac8 21 }
tony1tf 2:2537a40d2ac8 22 for (i=0; i<11; i++) {
tony1tf 2:2537a40d2ac8 23 greenpwm.pulsewidth_ms(i);
divyastra 5:80b4f48cd3db 24 printf("greenpwm set to %.2f %%\n", greenpwm.read() * 100);
tony1tf 2:2537a40d2ac8 25 wait(0.1);
tony1tf 2:2537a40d2ac8 26 }
tony1tf 2:2537a40d2ac8 27 for (i=0; i<11; i++) {
tony1tf 2:2537a40d2ac8 28 bluepwm.pulsewidth_ms(i);
divyastra 5:80b4f48cd3db 29 printf("bluepwm set to %.2f %%\n", bluepwm.read() * 100);
tony1tf 2:2537a40d2ac8 30 wait(0.1);
tony1tf 2:2537a40d2ac8 31 }
spyclub 4:c4dbac2f3e48 32 }
tony1tf 2:2537a40d2ac8 33
spyclub 3:8de335bdec0f 34 }