GPIO program for K64F boards
Dependencies: mbed DigitDisplay LED_Bar
main.cpp@2:a1e7d7fa0db2, 2020-02-05 (annotated)
- Committer:
- Niranjan_ravi
- Date:
- Wed Feb 05 19:46:54 2020 +0000
- Revision:
- 2:a1e7d7fa0db2
- Parent:
- 0:880457ab5a77
LED BAR library program;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Niranjan_ravi | 0:880457ab5a77 | 1 | #include "mbed.h" |
Niranjan_ravi | 2:a1e7d7fa0db2 | 2 | //PWM output channel |
Niranjan_ravi | 2:a1e7d7fa0db2 | 3 | PwmOut PWM1(A5); |
Niranjan_ravi | 2:a1e7d7fa0db2 | 4 | int main() |
Niranjan_ravi | 2:a1e7d7fa0db2 | 5 | { |
Niranjan_ravi | 2:a1e7d7fa0db2 | 6 | PWM1.period_ms(500); |
Niranjan_ravi | 2:a1e7d7fa0db2 | 7 | int x; |
Niranjan_ravi | 2:a1e7d7fa0db2 | 8 | x=1; |
Niranjan_ravi | 2:a1e7d7fa0db2 | 9 | while(1) |
Niranjan_ravi | 2:a1e7d7fa0db2 | 10 | { |
Niranjan_ravi | 2:a1e7d7fa0db2 | 11 | PWM1.pulsewidth_ms(x); |
Niranjan_ravi | 2:a1e7d7fa0db2 | 12 | x=x+1; |
Niranjan_ravi | 2:a1e7d7fa0db2 | 13 | wait(2); |
Niranjan_ravi | 2:a1e7d7fa0db2 | 14 | if(x==500) |
Niranjan_ravi | 2:a1e7d7fa0db2 | 15 | { |
Niranjan_ravi | 2:a1e7d7fa0db2 | 16 | x=1; |
Niranjan_ravi | 2:a1e7d7fa0db2 | 17 | } |
Niranjan_ravi | 2:a1e7d7fa0db2 | 18 | } |
Niranjan_ravi | 0:880457ab5a77 | 19 | } |