Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Encoder HIDScope mbed
Fork of DemoHidScopeEncoder by
main.cpp@1:bac42065f837, 2015-10-07 (annotated)
- Committer:
- arunr
- Date:
- Wed Oct 07 13:18:35 2015 +0000
- Revision:
- 1:bac42065f837
- Parent:
- 0:0b39982f89a9
- Child:
- 2:174885cd1665
motor draaien en encoder aflezen;
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 | |
arunr | 1:bac42065f837 | 9 | DigitalOut motor_direction(D4); |
arunr | 1:bac42065f837 | 10 | PwmOut motor_speed(D5); |
arunr | 1:bac42065f837 | 11 | |
vsluiter | 0:0b39982f89a9 | 12 | int main() |
vsluiter | 0:0b39982f89a9 | 13 | { |
arunr | 1:bac42065f837 | 14 | motor_direction = 1; |
arunr | 1:bac42065f837 | 15 | motor_speed = 0.5; |
arunr | 1:bac42065f837 | 16 | |
vsluiter | 0:0b39982f89a9 | 17 | while (true) { |
arunr | 1:bac42065f837 | 18 | |
vsluiter | 0:0b39982f89a9 | 19 | scope.set(0,motor1.getPosition()); |
vsluiter | 0:0b39982f89a9 | 20 | led.write(motor1.getPosition()/100.0); |
vsluiter | 0:0b39982f89a9 | 21 | scope.send(); |
vsluiter | 0:0b39982f89a9 | 22 | wait(0.2f); |
vsluiter | 0:0b39982f89a9 | 23 | } |
vsluiter | 0:0b39982f89a9 | 24 | } |