.
Dependencies: HCSR04v2 Servo mbed
Fork of CZOSINHO by
Engine.h@0:5919ea7b3b90, 2016-06-21 (annotated)
- Committer:
- yruiewyrui3
- Date:
- Tue Jun 21 07:45:32 2016 +0000
- Revision:
- 0:5919ea7b3b90
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yruiewyrui3 | 0:5919ea7b3b90 | 1 | #ifndef ENGINE_H |
yruiewyrui3 | 0:5919ea7b3b90 | 2 | #define ENGINE_H |
yruiewyrui3 | 0:5919ea7b3b90 | 3 | |
yruiewyrui3 | 0:5919ea7b3b90 | 4 | #include "mbed.h" |
yruiewyrui3 | 0:5919ea7b3b90 | 5 | |
yruiewyrui3 | 0:5919ea7b3b90 | 6 | |
yruiewyrui3 | 0:5919ea7b3b90 | 7 | class Engine{ |
yruiewyrui3 | 0:5919ea7b3b90 | 8 | private: |
yruiewyrui3 | 0:5919ea7b3b90 | 9 | PwmOut _pwm; |
yruiewyrui3 | 0:5919ea7b3b90 | 10 | DigitalOut _fwd; |
yruiewyrui3 | 0:5919ea7b3b90 | 11 | DigitalOut _rev; |
yruiewyrui3 | 0:5919ea7b3b90 | 12 | |
yruiewyrui3 | 0:5919ea7b3b90 | 13 | float getPwm(float val); |
yruiewyrui3 | 0:5919ea7b3b90 | 14 | |
yruiewyrui3 | 0:5919ea7b3b90 | 15 | public: |
yruiewyrui3 | 0:5919ea7b3b90 | 16 | Engine(PinName pwm, PinName fwd, PinName rev): _pwm(pwm), _fwd(fwd), _rev(rev){} |
yruiewyrui3 | 0:5919ea7b3b90 | 17 | void move(int speed); // silniki pracuja z okreslona predkoscia (speed ma zakres od -1 do 1) |
yruiewyrui3 | 0:5919ea7b3b90 | 18 | void stop(); //hard stop |
yruiewyrui3 | 0:5919ea7b3b90 | 19 | }; |
yruiewyrui3 | 0:5919ea7b3b90 | 20 | |
yruiewyrui3 | 0:5919ea7b3b90 | 21 | |
yruiewyrui3 | 0:5919ea7b3b90 | 22 | #endif |