Decoupled position and current control working.
main.cpp@1:30696e4d196b, 2010-08-11 (annotated)
- Committer:
- aberk
- Date:
- Wed Aug 11 09:15:10 2010 +0000
- Revision:
- 1:30696e4d196b
- Parent:
- 0:bcff39fac858
- Child:
- 2:89bb6272869b
Added an example of creating a QEI with X4 encoding, as opposed to the default X2 encoding option.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aberk | 0:bcff39fac858 | 1 | #include "QEI.h" |
aberk | 0:bcff39fac858 | 2 | |
aberk | 0:bcff39fac858 | 3 | Serial pc(USBTX, USBRX); |
aberk | 1:30696e4d196b | 4 | //Use X4 encoding. |
aberk | 1:30696e4d196b | 5 | //QEI wheel(p29, p30, NC, 624, QEI::X4_ENCODING); |
aberk | 1:30696e4d196b | 6 | //Use X2 encoding by default. |
aberk | 1:30696e4d196b | 7 | QEI wheel (p29, p30, NC, 624); |
aberk | 0:bcff39fac858 | 8 | |
aberk | 0:bcff39fac858 | 9 | int main() { |
aberk | 0:bcff39fac858 | 10 | |
aberk | 0:bcff39fac858 | 11 | while(1){ |
aberk | 1:30696e4d196b | 12 | wait(0.1); |
aberk | 0:bcff39fac858 | 13 | pc.printf("Pulses is: %i\n", wheel.getPulses()); |
aberk | 0:bcff39fac858 | 14 | } |
aberk | 0:bcff39fac858 | 15 | |
aberk | 0:bcff39fac858 | 16 | } |