relayMD
Fork of Motor by
motor.cpp
- Committer:
- number_key
- Date:
- 2016-09-29
- Revision:
- 1:0efe3050d83e
- Parent:
- 0:ebfdfce2d069
File content as of revision 1:0efe3050d83e:
#include "motor.h" #include "mbed.h" Motor::Motor(PinName pin1, PinName pin2, PinName pin3) : _pin1(pin1), _pin2(pin2), _pin3(pin3) { _pin1 = 0; _pin2 = 0; _pin3 = 0; } void Motor::motor(double n) { _pin1 = (n<0); _pin2 = (n>0); if(n) _pin3 = 1.0; else _pin3 = fabs(n); }