Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ESC SR04 TSI
Diff: motor/motor.h
- Revision:
- 16:5f736b955d53
diff -r f07910c5b815 -r 5f736b955d53 motor/motor.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/motor/motor.h Thu Jun 06 00:18:29 2013 +0000
@@ -0,0 +1,41 @@
+/******************************* motor.h *********************************/
+/* Version: 1.0 */
+/* Last Updated: June 1, 2013 */
+/* */
+/* The motor class is used for motor control using a PWM ECS. When a */
+/*a motor object is created you must pass the PWM pin as the only */
+/*argument. */
+/* */
+/* Wiring diagrams */
+/* _______ _______ */
+/* CW ----| | CCW ---\/ --| | */
+/* ----| Motor | ---/\---| Motor | */
+/* ----|_______| --/ \--|_______| */
+/* Straight through Switch wire 1 and 3 */
+/* */
+/*************************************************************************/
+
+
+#ifndef MOTOR_H
+#define MOTOR_H
+
+#include "mbed.h"
+
+class motor
+{
+ public:
+ motor( PinName ); // motor object constructor.
+ void setSpeed( int ); // Set the speed for the motor 0-100
+ void setPulseMin( float ); // Set smallest pulse.
+ void setPulseMax( float ); // Set largest pulse.
+ float getPulse( void );
+
+ private:
+ PwmOut _pwm; // Pin used for PWM.
+ int currentSpeed; // Speed of the motor.
+ float pulse;
+ float pulseMin; // Shortest value for the pulse
+ float pulseMax; // Largest value for the pulse..
+};
+
+#endif
\ No newline at end of file
