Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.
motor.h@0:7f26f0680202, 2010-12-31 (annotated)
- Committer:
- networker
- Date:
- Fri Dec 31 14:01:14 2010 +0000
- Revision:
- 0:7f26f0680202
initial release: comprises ftlib (no usb), ft-over-ip socket server, and the http server (the html page and java jar I still have to publish somewhere)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
networker | 0:7f26f0680202 | 1 | #ifndef MOTOR_H |
networker | 0:7f26f0680202 | 2 | #define MOTOR_H |
networker | 0:7f26f0680202 | 3 | |
networker | 0:7f26f0680202 | 4 | class motor |
networker | 0:7f26f0680202 | 5 | { DigitalOut& _en; |
networker | 0:7f26f0680202 | 6 | PwmOut &_a, &_b; |
networker | 0:7f26f0680202 | 7 | public: |
networker | 0:7f26f0680202 | 8 | motor(const PinName a, const PinName b, const PinName en): _en(*new DigitalOut(en)), _a(*new PwmOut(a)), _b(*new PwmOut(b)) |
networker | 0:7f26f0680202 | 9 | { _en = 1; _a.period_ms(1);} |
networker | 0:7f26f0680202 | 10 | void set(float speed) { if (speed<0) { _a = 0; _b = speed;} else { _a = speed; _b = 0;}} |
networker | 0:7f26f0680202 | 11 | void enable(bool e) { _en = e;} |
networker | 0:7f26f0680202 | 12 | }; |
networker | 0:7f26f0680202 | 13 | /* |
networker | 0:7f26f0680202 | 14 | class motor2 |
networker | 0:7f26f0680202 | 15 | { PwmOut& _en; |
networker | 0:7f26f0680202 | 16 | DigitalOut &_a, &_b; |
networker | 0:7f26f0680202 | 17 | public: |
networker | 0:7f26f0680202 | 18 | motor2(PinName a, PinName b, PinName en): _en(en), _a(a), _b(b){ _a = 0; _b = 0; _en.period_ms(1);} |
networker | 0:7f26f0680202 | 19 | void set(float speed) { if (speed<0) { _a = 0; _b = 1;} else { _a = 1; _b = 0;} _en = speed; } |
networker | 0:7f26f0680202 | 20 | void enable(bool e) { if (e) {} else { _en = 0;} |
networker | 0:7f26f0680202 | 21 | }; |
networker | 0:7f26f0680202 | 22 | */ |
networker | 0:7f26f0680202 | 23 | #endif |