A simple class which can be used to control a motor through a HBridge (such as the L293).
HBridgeMotor.h@0:a3bcb7eab9d9, 2011-09-20 (annotated)
- Committer:
- harryeakins
- Date:
- Tue Sep 20 12:54:36 2011 +0000
- Revision:
- 0:a3bcb7eab9d9
Initial version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
harryeakins | 0:a3bcb7eab9d9 | 1 | #include "mbed.h" |
harryeakins | 0:a3bcb7eab9d9 | 2 | |
harryeakins | 0:a3bcb7eab9d9 | 3 | class HBridgeMotor { |
harryeakins | 0:a3bcb7eab9d9 | 4 | public: |
harryeakins | 0:a3bcb7eab9d9 | 5 | HBridgeMotor(PinName fin, PinName rin); |
harryeakins | 0:a3bcb7eab9d9 | 6 | void set(float power); |
harryeakins | 0:a3bcb7eab9d9 | 7 | float read(); |
harryeakins | 0:a3bcb7eab9d9 | 8 | |
harryeakins | 0:a3bcb7eab9d9 | 9 | private: |
harryeakins | 0:a3bcb7eab9d9 | 10 | float power; |
harryeakins | 0:a3bcb7eab9d9 | 11 | PwmOut fwd, rev; |
harryeakins | 0:a3bcb7eab9d9 | 12 | }; |