Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.

Dependencies:   mbed ConfigFile

motor.h

Committer:
networker
Date:
2010-12-31
Revision:
0:7f26f0680202

File content as of revision 0:7f26f0680202:

#ifndef MOTOR_H
#define MOTOR_H

class motor
{ DigitalOut& _en;
  PwmOut &_a, &_b;
public:
  motor(const PinName a, const PinName b, const PinName en): _en(*new DigitalOut(en)), _a(*new PwmOut(a)), _b(*new PwmOut(b))
                                                                { _en = 1; _a.period_ms(1);}
  void set(float speed) { if (speed<0) { _a = 0; _b = speed;} else { _a = speed; _b = 0;}}
  void enable(bool e) { _en = e;}
};
/*
class motor2
{ PwmOut& _en;
  DigitalOut &_a, &_b;
public:
  motor2(PinName a, PinName b, PinName en): _en(en), _a(a), _b(b){ _a = 0; _b = 0; _en.period_ms(1);}
  void set(float speed) { if (speed<0) { _a = 0; _b = 1;} else { _a = 1; _b = 0;} _en = speed; }
  void enable(bool e) { if (e) {} else { _en = 0;}
};
*/
#endif