V1

Dependents:   VITI_motor_angle_1 VITI_motor_angle_2 VITI_motor_angle_3

Revision:
0:1b8889c40a44
diff -r 000000000000 -r 1b8889c40a44 TB6549.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TB6549.h	Thu May 21 17:42:47 2020 +0000
@@ -0,0 +1,43 @@
+/* mbed simple H-bridge motor controller
+ * Copyright (c) 
+ 
+ */
+ 
+#ifndef MBED_MOTOR_H
+#define MBED_MOTOR_H
+ 
+#include "mbed.h"
+ 
+/** Interface to control a standard DC motor 
+ *
+ * with an H-bridge using a PwmOut and 3 DigitalOuts
+ */
+class Motor {
+public:
+ 
+    /** Create a motor control interface    
+     *
+     * @param pwm A PwmOut pin, driving the H-bridge enable line to control the speed
+     * @param in1 A DigitalOut, 
+     * @param in2 A DigitalOut, 
+     * @param sb  
+     A DigitalOut, 
+     */
+    Motor(PinName pwm, PinName in1, PinName in2, PinName sb);
+    
+    /** Set the speed of the motor
+     * 
+     * @param speed The speed of the motor as a normalised value between -1.0 and 1.0
+     */
+    void speed(float speed);
+ 
+protected:
+    PwmOut _pwm;
+    DigitalOut _in1;
+    DigitalOut _in2;
+    DigitalOut _sb;
+ 
+};
+ 
+#endif
+ 
\ No newline at end of file