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 Servo ros_lib_kinetic
Motors/Motor.h
- Committer:
- Stumi
- Date:
- 2019-10-24
- Revision:
- 3:df6160e2f6d9
- Parent:
- 2:6197e1cf2cd1
- Child:
- 4:36a04230554d
File content as of revision 3:df6160e2f6d9:
/*--------------------------------------------------------------------------------
Filename: TOF.h
Description: Header file for adafruit VL_6180X TOF sensor
--------------------------------------------------------------------------------*/
#ifndef MOTOR_H
#define MOTOR_H
#include "mbed.h"
/*--------------------------------------------------------------------------------
---------------------------------DEFINES------------------------------------------
--------------------------------------------------------------------------------*/
//MOTOR 1
#define M1_IN1 PC_6
#define M1_IN2 PB_15
#define M1_PWM PB_13
#define M1_A PA_4
#define M1_B PB_12
//MOTOR 2
#define M2_IN1 PA_15
#define M2_IN2 PC_7
#define M2_PWM PB_4
#define M2_A PB_5
#define M2_B PB_3
/*--------------------------------------------------------------------------------
---------------------------------CLASSES------------------------------------------
--------------------------------------------------------------------------------*/
// Class for managing connection and state to a VL6180X sensor
class cMotor
{
public:
cMotor(PwmOut pwm, DigitalOut fwd, DigitalOut rev); //Constructor, initialised motor pinouts
void Forwards(float speed);
void Backwards(float speed);
void Stop();
private:
PwmOut _pwm;
DigitalOut _fwd;
DigitalOut _rev;
};
/*--------------------------------------------------------------------------------
-----------------------------------Functions---------------------------------------
--------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------
--------------------------------External Variables--------------------------------
--------------------------------------------------------------------------------*/
#endif