This is a test program for the rotary encoder library.
Dependencies: mbed RotaryEncoder
main.cpp@0:42b87911a93e, 2010-12-19 (annotated)
- Committer:
- shintamainjp
- Date:
- Sun Dec 19 05:04:31 2010 +0000
- Revision:
- 0:42b87911a93e
Initial version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shintamainjp | 0:42b87911a93e | 1 | /** |
shintamainjp | 0:42b87911a93e | 2 | * ============================================================================= |
shintamainjp | 0:42b87911a93e | 3 | * A test program for Rotary Encoder class (Version 0.0.1) |
shintamainjp | 0:42b87911a93e | 4 | * ============================================================================= |
shintamainjp | 0:42b87911a93e | 5 | * Copyright (c) 2010 Shinichiro Nakamura (CuBeatSystems) |
shintamainjp | 0:42b87911a93e | 6 | * |
shintamainjp | 0:42b87911a93e | 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
shintamainjp | 0:42b87911a93e | 8 | * of this software and associated documentation files (the "Software"), to deal |
shintamainjp | 0:42b87911a93e | 9 | * in the Software without restriction, including without limitation the rights |
shintamainjp | 0:42b87911a93e | 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
shintamainjp | 0:42b87911a93e | 11 | * copies of the Software, and to permit persons to whom the Software is |
shintamainjp | 0:42b87911a93e | 12 | * furnished to do so, subject to the following conditions: |
shintamainjp | 0:42b87911a93e | 13 | * |
shintamainjp | 0:42b87911a93e | 14 | * The above copyright notice and this permission notice shall be included in |
shintamainjp | 0:42b87911a93e | 15 | * all copies or substantial portions of the Software. |
shintamainjp | 0:42b87911a93e | 16 | * |
shintamainjp | 0:42b87911a93e | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
shintamainjp | 0:42b87911a93e | 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
shintamainjp | 0:42b87911a93e | 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
shintamainjp | 0:42b87911a93e | 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
shintamainjp | 0:42b87911a93e | 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
shintamainjp | 0:42b87911a93e | 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
shintamainjp | 0:42b87911a93e | 23 | * THE SOFTWARE. |
shintamainjp | 0:42b87911a93e | 24 | * ============================================================================= |
shintamainjp | 0:42b87911a93e | 25 | */ |
shintamainjp | 0:42b87911a93e | 26 | |
shintamainjp | 0:42b87911a93e | 27 | #include "mbed.h" |
shintamainjp | 0:42b87911a93e | 28 | #include "RotaryEncoder.h" |
shintamainjp | 0:42b87911a93e | 29 | |
shintamainjp | 0:42b87911a93e | 30 | RotaryEncoder re(p17, p18); |
shintamainjp | 0:42b87911a93e | 31 | |
shintamainjp | 0:42b87911a93e | 32 | int main() { |
shintamainjp | 0:42b87911a93e | 33 | while(1) { |
shintamainjp | 0:42b87911a93e | 34 | printf("value=%d\n", re.getVal()); |
shintamainjp | 0:42b87911a93e | 35 | wait_ms(200); |
shintamainjp | 0:42b87911a93e | 36 | } |
shintamainjp | 0:42b87911a93e | 37 | } |