![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
This is a very simple guide, reviewing the steps required to get Blinky working on an Mbed OS platform.
Dependencies: mbed Adafruit_GFX
Drive.cpp
- Committer:
- ParkChunMyong
- Date:
- 2019-06-08
- Revision:
- 95:250afd53b710
File content as of revision 95:250afd53b710:
#include "Drive.h" Drive::Drive(PinName pwmA, PinName pwmB, PinName Ain1, PinName Ain2, PinName Bin1, PinName Bin2): _pwmA(pwmA), _pwmB(pwmB), _AIN1(Ain1), _AIN2(Ain2), _BIN1(Bin1), _BIN2(Bin2){ } Drive::~Drive(){ } void Drive::Forward(){ _pwmA.pulsewidth_us(left_Speed); _pwmB.pulsewidth_us(right_Speed); _AIN1 = LOW; _AIN2 = HIGH; _BIN1 = LOW; _BIN2 = HIGH; } void Drive::Backward(){ _pwmA.pulsewidth_us(left_Speed); _pwmB.pulsewidth_us(right_Speed); _AIN1 = HIGH; _AIN2 = LOW; _BIN1 = HIGH; _BIN2 = LOW; } void Drive::Turn_left(){ _pwmA.pulsewidth_us(left_Speed); _pwmB.pulsewidth_us(right_Speed); _AIN1 = HIGH; _AIN2 = LOW; _BIN1 = LOW; _BIN2 = HIGH; } void Drive::Turn_right(){ _pwmA.pulsewidth_us(left_Speed); _pwmB.pulsewidth_us(right_Speed); _AIN1 = LOW; _AIN2 = HIGH; _BIN1 = HIGH; _BIN2 = LOW; } void Drive::Break(){ _AIN1 = LOW; _AIN2 = LOW; _BIN1 = LOW; _BIN2 = LOW; } void Drive::setSpeed(int speed){ left_Speed = speed; right_Speed = speed; } void Drive::setSpeed(int speed1, int speed2){ left_Speed = speed1; right_Speed = speed2; }