Tests motors - increments one, decrements the other
Dependencies: mbed
Fork of FRDM-K64_PWM by
main.cpp@0:24a5f9b6fd64, 2014-07-09 (annotated)
- Committer:
- APanecatl
- Date:
- Wed Jul 09 19:31:42 2014 +0000
- Revision:
- 0:24a5f9b6fd64
- Child:
- 1:fd419b982c73
rev 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
APanecatl | 0:24a5f9b6fd64 | 1 | #include "mbed.h" |
APanecatl | 0:24a5f9b6fd64 | 2 | |
APanecatl | 0:24a5f9b6fd64 | 3 | //PWM output channel |
APanecatl | 0:24a5f9b6fd64 | 4 | PwmOut PWM1(A5); |
APanecatl | 0:24a5f9b6fd64 | 5 | |
APanecatl | 0:24a5f9b6fd64 | 6 | int main() |
APanecatl | 0:24a5f9b6fd64 | 7 | { |
APanecatl | 0:24a5f9b6fd64 | 8 | PWM1.period_ms(500); |
APanecatl | 0:24a5f9b6fd64 | 9 | int x; |
APanecatl | 0:24a5f9b6fd64 | 10 | x=1; |
APanecatl | 0:24a5f9b6fd64 | 11 | |
APanecatl | 0:24a5f9b6fd64 | 12 | while(1) |
APanecatl | 0:24a5f9b6fd64 | 13 | { |
APanecatl | 0:24a5f9b6fd64 | 14 | PWM1.pulsewidth_ms(x); |
APanecatl | 0:24a5f9b6fd64 | 15 | x=x+1; |
APanecatl | 0:24a5f9b6fd64 | 16 | wait(.1); |
APanecatl | 0:24a5f9b6fd64 | 17 | if(x==500) |
APanecatl | 0:24a5f9b6fd64 | 18 | { |
APanecatl | 0:24a5f9b6fd64 | 19 | x=1; |
APanecatl | 0:24a5f9b6fd64 | 20 | } |
APanecatl | 0:24a5f9b6fd64 | 21 | } |
APanecatl | 0:24a5f9b6fd64 | 22 | } |