SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Committer:
hazheng
Date:
Mon Feb 06 21:07:52 2017 +0000
Revision:
9:b72e18f80f49
Parent:
Motor.h@8:92f6baeea027
Child:
11:676ea42afd56
Moved hardware interface class to the hardware folder.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bobymicjohn 4:25e028102625 1 #pragma once
Bobymicjohn 8:92f6baeea027 2
Bobymicjohn 8:92f6baeea027 3 #include <mbed.h>
Bobymicjohn 8:92f6baeea027 4
Bobymicjohn 8:92f6baeea027 5 #define MotorDir unsigned char
Bobymicjohn 8:92f6baeea027 6 #define MDIR_Forward 1
Bobymicjohn 8:92f6baeea027 7 #define MDIR_Backward 0
Bobymicjohn 8:92f6baeea027 8
Bobymicjohn 4:25e028102625 9
Bobymicjohn 4:25e028102625 10 class Motor{
Bobymicjohn 4:25e028102625 11
Bobymicjohn 4:25e028102625 12 public:
Bobymicjohn 4:25e028102625 13
Bobymicjohn 4:25e028102625 14 Motor();
Bobymicjohn 4:25e028102625 15
Bobymicjohn 4:25e028102625 16 ~Motor();
Bobymicjohn 4:25e028102625 17
Bobymicjohn 8:92f6baeea027 18 void Update(float deltaTime);
Bobymicjohn 8:92f6baeea027 19
Bobymicjohn 8:92f6baeea027 20 void setLeftSpeed(float speed);
Bobymicjohn 8:92f6baeea027 21
Bobymicjohn 8:92f6baeea027 22 void setRightSpeed(float speed);
Bobymicjohn 4:25e028102625 23
Bobymicjohn 8:92f6baeea027 24 void setSpeeds(float speedLeft, float speedRight);
Bobymicjohn 8:92f6baeea027 25
Bobymicjohn 8:92f6baeea027 26 void setLeftDirection(MotorDir dir);
Bobymicjohn 4:25e028102625 27
Bobymicjohn 8:92f6baeea027 28 void setRightDirection(MotorDir dir);
Bobymicjohn 8:92f6baeea027 29
Bobymicjohn 8:92f6baeea027 30 void setDirections(MotorDir dirL, MotorDir dirR);
Bobymicjohn 4:25e028102625 31
Bobymicjohn 4:25e028102625 32 private:
Bobymicjohn 8:92f6baeea027 33 DigitalOut m_dirL;
Bobymicjohn 8:92f6baeea027 34 DigitalOut m_dirR;
Bobymicjohn 4:25e028102625 35
Bobymicjohn 8:92f6baeea027 36 PwmOut m_pwmL;
Bobymicjohn 8:92f6baeea027 37 PwmOut m_pwmR;
Bobymicjohn 8:92f6baeea027 38
Bobymicjohn 4:25e028102625 39 };