Werkt dit?
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
main.cpp@2:bbaa6fca2ab1, 2019-10-02 (annotated)
- Committer:
- joostbonekamp
- Date:
- Wed Oct 02 11:22:51 2019 +0000
- Revision:
- 2:bbaa6fca2ab1
- Parent:
- 1:b862262a9d14
- Child:
- 3:e3d12393adb1
motor pwm test;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RobertoO | 0:67c50348f842 | 1 | #include "mbed.h" |
RobertoO | 1:b862262a9d14 | 2 | #include "MODSERIAL.h" |
joostbonekamp | 2:bbaa6fca2ab1 | 3 | #include "FastPWM.h" |
joostbonekamp | 2:bbaa6fca2ab1 | 4 | #include "QEI.h" |
RobertoO | 0:67c50348f842 | 5 | |
joostbonekamp | 2:bbaa6fca2ab1 | 6 | DigitalOut motor2_direction(D4); |
joostbonekamp | 2:bbaa6fca2ab1 | 7 | PwmOut motor2_pwm(D5); |
RobertoO | 0:67c50348f842 | 8 | |
joostbonekamp | 2:bbaa6fca2ab1 | 9 | int main() { |
RobertoO | 0:67c50348f842 | 10 | while (true) { |
joostbonekamp | 2:bbaa6fca2ab1 | 11 | motor2_direction = 1; |
joostbonekamp | 2:bbaa6fca2ab1 | 12 | for (float i = 0; i < 1; i+=0.01) { |
joostbonekamp | 2:bbaa6fca2ab1 | 13 | motor2_pwm = i; |
joostbonekamp | 2:bbaa6fca2ab1 | 14 | wait(0.1); |
joostbonekamp | 2:bbaa6fca2ab1 | 15 | } |
joostbonekamp | 2:bbaa6fca2ab1 | 16 | motor2_direction = 0; |
joostbonekamp | 2:bbaa6fca2ab1 | 17 | for (float i = 0; i < 1; i+=0.01) { |
joostbonekamp | 2:bbaa6fca2ab1 | 18 | motor2_pwm = i; |
joostbonekamp | 2:bbaa6fca2ab1 | 19 | wait(0.1); |
joostbonekamp | 2:bbaa6fca2ab1 | 20 | } |
RobertoO | 0:67c50348f842 | 21 | } |
RobertoO | 0:67c50348f842 | 22 | } |
joostbonekamp | 2:bbaa6fca2ab1 | 23 |