Tom Tom
/
HIDScope-demo
A simple demo
main.cpp@2:68e99835d7c6, 2017-07-30 (annotated)
- Committer:
- tomlankhorst
- Date:
- Sun Jul 30 17:50:22 2017 +0000
- Revision:
- 2:68e99835d7c6
- Parent:
- 0:ce88dd5f370c
Removed old mbed rev notif
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tomlankhorst | 0:ce88dd5f370c | 1 | #include "mbed.h" |
tomlankhorst | 0:ce88dd5f370c | 2 | #include "HIDScope.h" |
tomlankhorst | 0:ce88dd5f370c | 3 | |
tomlankhorst | 0:ce88dd5f370c | 4 | HIDScope scope( 2 ); |
tomlankhorst | 0:ce88dd5f370c | 5 | AnalogIn a0( A0 ); |
tomlankhorst | 0:ce88dd5f370c | 6 | AnalogIn a1( A1 ); |
tomlankhorst | 0:ce88dd5f370c | 7 | Ticker controllerTimer; |
tomlankhorst | 0:ce88dd5f370c | 8 | DigitalOut led(LED_RED); |
tomlankhorst | 0:ce88dd5f370c | 9 | |
tomlankhorst | 0:ce88dd5f370c | 10 | void sample() |
tomlankhorst | 0:ce88dd5f370c | 11 | { |
tomlankhorst | 0:ce88dd5f370c | 12 | scope.set(0,a0.read()); |
tomlankhorst | 0:ce88dd5f370c | 13 | scope.set(1,a1.read()); |
tomlankhorst | 0:ce88dd5f370c | 14 | scope.send(); |
tomlankhorst | 0:ce88dd5f370c | 15 | led = !led; |
tomlankhorst | 0:ce88dd5f370c | 16 | } |
tomlankhorst | 0:ce88dd5f370c | 17 | |
tomlankhorst | 0:ce88dd5f370c | 18 | int main() |
tomlankhorst | 0:ce88dd5f370c | 19 | { |
tomlankhorst | 0:ce88dd5f370c | 20 | |
tomlankhorst | 0:ce88dd5f370c | 21 | controllerTimer.attach_us(&sample, 2e3); |
tomlankhorst | 0:ce88dd5f370c | 22 | |
tomlankhorst | 0:ce88dd5f370c | 23 | while(1){ } |
tomlankhorst | 0:ce88dd5f370c | 24 | |
tomlankhorst | 0:ce88dd5f370c | 25 | } |