![](/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.h@96:7465ab270e7a, 2019-06-13 (annotated)
- Committer:
- ParkChunMyong
- Date:
- Thu Jun 13 03:26:42 2019 +0000
- Revision:
- 96:7465ab270e7a
- Parent:
- 95:250afd53b710
first init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ParkChunMyong | 95:250afd53b710 | 1 | #ifndef __DRIVE_H__ |
ParkChunMyong | 95:250afd53b710 | 2 | #define __DRIVE_H__ |
ParkChunMyong | 95:250afd53b710 | 3 | |
ParkChunMyong | 95:250afd53b710 | 4 | #include "mbed.h" |
ParkChunMyong | 95:250afd53b710 | 5 | |
ParkChunMyong | 95:250afd53b710 | 6 | #define HIGH 1 |
ParkChunMyong | 95:250afd53b710 | 7 | #define LOW 0 |
ParkChunMyong | 95:250afd53b710 | 8 | |
ParkChunMyong | 95:250afd53b710 | 9 | class Drive{ |
ParkChunMyong | 95:250afd53b710 | 10 | |
ParkChunMyong | 95:250afd53b710 | 11 | private: |
ParkChunMyong | 95:250afd53b710 | 12 | PwmOut _pwmA; |
ParkChunMyong | 95:250afd53b710 | 13 | PwmOut _pwmB; |
ParkChunMyong | 95:250afd53b710 | 14 | DigitalOut _AIN1; |
ParkChunMyong | 95:250afd53b710 | 15 | DigitalOut _AIN2; |
ParkChunMyong | 95:250afd53b710 | 16 | DigitalOut _BIN1; |
ParkChunMyong | 95:250afd53b710 | 17 | DigitalOut _BIN2; |
ParkChunMyong | 95:250afd53b710 | 18 | int left_Speed; |
ParkChunMyong | 95:250afd53b710 | 19 | int right_Speed; |
ParkChunMyong | 95:250afd53b710 | 20 | |
ParkChunMyong | 95:250afd53b710 | 21 | public: |
ParkChunMyong | 95:250afd53b710 | 22 | Drive(PinName pwmA, PinName pwmB, PinName Ain1, PinName Ain2, PinName Bin1, PinName Bin2); |
ParkChunMyong | 95:250afd53b710 | 23 | |
ParkChunMyong | 95:250afd53b710 | 24 | ~Drive(); |
ParkChunMyong | 95:250afd53b710 | 25 | |
ParkChunMyong | 95:250afd53b710 | 26 | void Forward(); |
ParkChunMyong | 95:250afd53b710 | 27 | |
ParkChunMyong | 95:250afd53b710 | 28 | void Backward(); |
ParkChunMyong | 95:250afd53b710 | 29 | |
ParkChunMyong | 95:250afd53b710 | 30 | void Turn_left(); |
ParkChunMyong | 95:250afd53b710 | 31 | |
ParkChunMyong | 95:250afd53b710 | 32 | void Turn_right(); |
ParkChunMyong | 95:250afd53b710 | 33 | |
ParkChunMyong | 95:250afd53b710 | 34 | void Break(); |
ParkChunMyong | 95:250afd53b710 | 35 | |
ParkChunMyong | 95:250afd53b710 | 36 | void setSpeed(int speed); |
ParkChunMyong | 95:250afd53b710 | 37 | |
ParkChunMyong | 95:250afd53b710 | 38 | void setSpeed(int speed1, int speed2); |
ParkChunMyong | 95:250afd53b710 | 39 | }; |
ParkChunMyong | 95:250afd53b710 | 40 | #endif |