This project will enable remote control of a motorised turntable via a WiFi enabled TCP link using ACKme's (http://ack.me/) Wi-Fi enablement platform
TurntableControl.h@2:a73037a7d85d, 2014-08-27 (annotated)
- Committer:
- Stathisn
- Date:
- Wed Aug 27 12:28:48 2014 +0000
- Revision:
- 2:a73037a7d85d
Cleaned up control code and created an object to handle its operation; Integrated feedback over serial for debugging purposes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Stathisn | 2:a73037a7d85d | 1 | #pragma once |
Stathisn | 2:a73037a7d85d | 2 | |
Stathisn | 2:a73037a7d85d | 3 | #include "mbed.h" |
Stathisn | 2:a73037a7d85d | 4 | |
Stathisn | 2:a73037a7d85d | 5 | class TurntableControl |
Stathisn | 2:a73037a7d85d | 6 | { |
Stathisn | 2:a73037a7d85d | 7 | private: |
Stathisn | 2:a73037a7d85d | 8 | int encoderMax; // Calibrated maximum value for the encoder |
Stathisn | 2:a73037a7d85d | 9 | int encoderCurrent; // Keeps track of the current position of the turn table |
Stathisn | 2:a73037a7d85d | 10 | DigitalIn encoder; |
Stathisn | 2:a73037a7d85d | 11 | DigitalIn limitSW; |
Stathisn | 2:a73037a7d85d | 12 | DigitalOut ttdriver; |
Stathisn | 2:a73037a7d85d | 13 | public: |
Stathisn | 2:a73037a7d85d | 14 | TurntableControl(); |
Stathisn | 2:a73037a7d85d | 15 | TurntableControl(PinName, PinName, PinName); |
Stathisn | 2:a73037a7d85d | 16 | void initialise(); |
Stathisn | 2:a73037a7d85d | 17 | int calibrate(); // synchronises and calibrates MCU to turntable |
Stathisn | 2:a73037a7d85d | 18 | void incrementTurntable(int); // increments value i, used as an interrupt target |
Stathisn | 2:a73037a7d85d | 19 | void reset(); |
Stathisn | 2:a73037a7d85d | 20 | int getEncoderCurrent(); |
Stathisn | 2:a73037a7d85d | 21 | int getEncoderMax(); |
Stathisn | 2:a73037a7d85d | 22 | int getEncoder(); |
Stathisn | 2:a73037a7d85d | 23 | void quarterTurns(int); |
Stathisn | 2:a73037a7d85d | 24 | }; |