encoder, HIDscope and movement
Dependencies: Encoder HIDScope mbed
Fork of MovementandEncoder by
main.cpp@0:0b39982f89a9, 2015-09-09 (annotated)
- Committer:
- vsluiter
- Date:
- Wed Sep 09 13:44:08 2015 +0000
- Revision:
- 0:0b39982f89a9
- Child:
- 1:bac42065f837
DemoBioRoboticsShield
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vsluiter | 0:0b39982f89a9 | 1 | #include "mbed.h" |
vsluiter | 0:0b39982f89a9 | 2 | #include "HIDScope.h" |
vsluiter | 0:0b39982f89a9 | 3 | #include "encoder.h" |
vsluiter | 0:0b39982f89a9 | 4 | |
vsluiter | 0:0b39982f89a9 | 5 | Encoder motor1(D13,D12); |
vsluiter | 0:0b39982f89a9 | 6 | PwmOut led(D9); |
vsluiter | 0:0b39982f89a9 | 7 | HIDScope scope(1); |
vsluiter | 0:0b39982f89a9 | 8 | |
vsluiter | 0:0b39982f89a9 | 9 | int main() |
vsluiter | 0:0b39982f89a9 | 10 | { |
vsluiter | 0:0b39982f89a9 | 11 | |
vsluiter | 0:0b39982f89a9 | 12 | while (true) { |
vsluiter | 0:0b39982f89a9 | 13 | scope.set(0,motor1.getPosition()); |
vsluiter | 0:0b39982f89a9 | 14 | led.write(motor1.getPosition()/100.0); |
vsluiter | 0:0b39982f89a9 | 15 | scope.send(); |
vsluiter | 0:0b39982f89a9 | 16 | wait(0.2f); |
vsluiter | 0:0b39982f89a9 | 17 | } |
vsluiter | 0:0b39982f89a9 | 18 | } |