This is just for bruce!!!
Dependencies: mbed
main.cpp@0:371aa9b6644f, 2014-07-12 (annotated)
- Committer:
- spyclub
- Date:
- Sat Jul 12 16:17:04 2014 +0000
- Revision:
- 0:371aa9b6644f
Special code just for Bruce
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spyclub | 0:371aa9b6644f | 1 | #include "mbed.h" |
spyclub | 0:371aa9b6644f | 2 | |
spyclub | 0:371aa9b6644f | 3 | PwmOut redpwm(D9); |
spyclub | 0:371aa9b6644f | 4 | PwmOut greenpwm(D10); |
spyclub | 0:371aa9b6644f | 5 | PwmOut bluepwm(D12); |
spyclub | 0:371aa9b6644f | 6 | |
spyclub | 0:371aa9b6644f | 7 | int main() |
spyclub | 0:371aa9b6644f | 8 | { |
spyclub | 0:371aa9b6644f | 9 | int i; |
spyclub | 0:371aa9b6644f | 10 | redpwm.period_ms(10); |
spyclub | 0:371aa9b6644f | 11 | greenpwm.period_ms(10); |
spyclub | 0:371aa9b6644f | 12 | bluepwm.period_ms(10); |
spyclub | 0:371aa9b6644f | 13 | |
spyclub | 0:371aa9b6644f | 14 | |
spyclub | 0:371aa9b6644f | 15 | |
spyclub | 0:371aa9b6644f | 16 | while(1) { |
spyclub | 0:371aa9b6644f | 17 | for (i=0; i<11; i++) { |
spyclub | 0:371aa9b6644f | 18 | redpwm.pulsewidth_ms(i); |
spyclub | 0:371aa9b6644f | 19 | printf("redpwm set to %.2f %%\n", redpwm.read() * 100); |
spyclub | 0:371aa9b6644f | 20 | |
spyclub | 0:371aa9b6644f | 21 | wait(0.1); |
spyclub | 0:371aa9b6644f | 22 | } |
spyclub | 0:371aa9b6644f | 23 | for (i=0; i<11; i++) { |
spyclub | 0:371aa9b6644f | 24 | greenpwm.pulsewidth_ms(i); |
spyclub | 0:371aa9b6644f | 25 | printf("greenpwm set to %.2f %%\n", greenpwm.read() * 100); |
spyclub | 0:371aa9b6644f | 26 | wait(0.1); |
spyclub | 0:371aa9b6644f | 27 | } |
spyclub | 0:371aa9b6644f | 28 | for (i=0; i<11; i++) { |
spyclub | 0:371aa9b6644f | 29 | bluepwm.pulsewidth_ms(i); |
spyclub | 0:371aa9b6644f | 30 | printf("bluepwm set to %.2f %%\n", bluepwm.read() * 100); |
spyclub | 0:371aa9b6644f | 31 | wait(0.1); |
spyclub | 0:371aa9b6644f | 32 | } |
spyclub | 0:371aa9b6644f | 33 | } |
spyclub | 0:371aa9b6644f | 34 | |
spyclub | 0:371aa9b6644f | 35 | } |