Generic Step Motor WebInterface - control a step motor using a Pololu A4983 driver from a webinterface (EXPERIMENTAL PROTOTYPE - just to be used as a proof-of-concept for a IoT talk, will not be updating this code so often)
Dependencies: EthernetNetIf RPCInterface mbed HTTPServer
CmdListObjects/TObjects.h@0:8b3857d4ce02, 2012-04-16 (annotated)
- Committer:
- botdream
- Date:
- Mon Apr 16 09:41:53 2012 +0000
- Revision:
- 0:8b3857d4ce02
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
botdream | 0:8b3857d4ce02 | 1 | //--------------------------------------------------------------------------------------------- |
botdream | 0:8b3857d4ce02 | 2 | #include "mbed.h" |
botdream | 0:8b3857d4ce02 | 3 | //--------------------------------------------------------------------------------------------- |
botdream | 0:8b3857d4ce02 | 4 | #define internaldebug |
botdream | 0:8b3857d4ce02 | 5 | //--------------------------------------------------------------------------------------------- |
botdream | 0:8b3857d4ce02 | 6 | class TObjects |
botdream | 0:8b3857d4ce02 | 7 | { |
botdream | 0:8b3857d4ce02 | 8 | private: |
botdream | 0:8b3857d4ce02 | 9 | |
botdream | 0:8b3857d4ce02 | 10 | public: |
botdream | 0:8b3857d4ce02 | 11 | |
botdream | 0:8b3857d4ce02 | 12 | TObjects(); |
botdream | 0:8b3857d4ce02 | 13 | }; |
botdream | 0:8b3857d4ce02 | 14 | //--------------------------------------------------------------------------------------------- |
botdream | 0:8b3857d4ce02 | 15 | |
botdream | 0:8b3857d4ce02 | 16 | class TObjectStep |
botdream | 0:8b3857d4ce02 | 17 | { |
botdream | 0:8b3857d4ce02 | 18 | private: |
botdream | 0:8b3857d4ce02 | 19 | |
botdream | 0:8b3857d4ce02 | 20 | public: |
botdream | 0:8b3857d4ce02 | 21 | static const uint8_t typecode = 0x01; |
botdream | 0:8b3857d4ce02 | 22 | uint32_t nsteps; |
botdream | 0:8b3857d4ce02 | 23 | uint32_t deltatime; |
botdream | 0:8b3857d4ce02 | 24 | uint8_t direction; |
botdream | 0:8b3857d4ce02 | 25 | |
botdream | 0:8b3857d4ce02 | 26 | TObjectStep(uint32_t insteps, uint32_t ideltatime, uint8_t idirection) |
botdream | 0:8b3857d4ce02 | 27 | { |
botdream | 0:8b3857d4ce02 | 28 | nsteps = insteps; |
botdream | 0:8b3857d4ce02 | 29 | deltatime = ideltatime; |
botdream | 0:8b3857d4ce02 | 30 | direction = idirection; |
botdream | 0:8b3857d4ce02 | 31 | |
botdream | 0:8b3857d4ce02 | 32 | #ifdef internaldebug |
botdream | 0:8b3857d4ce02 | 33 | printf("->->TObjectStep(%d,%d,%d).\r\n",nsteps,deltatime,direction); |
botdream | 0:8b3857d4ce02 | 34 | #endif |
botdream | 0:8b3857d4ce02 | 35 | }; |
botdream | 0:8b3857d4ce02 | 36 | }; |
botdream | 0:8b3857d4ce02 | 37 | //--------------------------------------------------------------------------------------------- |
botdream | 0:8b3857d4ce02 | 38 | |
botdream | 0:8b3857d4ce02 | 39 | class TObjectWait |
botdream | 0:8b3857d4ce02 | 40 | { |
botdream | 0:8b3857d4ce02 | 41 | private: |
botdream | 0:8b3857d4ce02 | 42 | |
botdream | 0:8b3857d4ce02 | 43 | public: |
botdream | 0:8b3857d4ce02 | 44 | static const uint8_t typecode = 0x04; |
botdream | 0:8b3857d4ce02 | 45 | uint32_t waittime; |
botdream | 0:8b3857d4ce02 | 46 | |
botdream | 0:8b3857d4ce02 | 47 | TObjectWait(uint32_t iwaittime) |
botdream | 0:8b3857d4ce02 | 48 | { |
botdream | 0:8b3857d4ce02 | 49 | waittime = iwaittime; |
botdream | 0:8b3857d4ce02 | 50 | }; |
botdream | 0:8b3857d4ce02 | 51 | }; |
botdream | 0:8b3857d4ce02 | 52 | //--------------------------------------------------------------------------------------------- |