movimiento cabina
Diff: elevator.cpp
- Revision:
- 0:e6eb579c2a24
- Child:
- 1:da94bffcc0d9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/elevator.cpp Tue Feb 20 19:53:55 2018 +0000 @@ -0,0 +1,32 @@ +#include "elevator.h" +#include "mbed.h" + +/* +*door.cpp +*/ + +Elevator::Elevator(PinName enable_, PinName up_, PinName down_): enable(enable_), up(up_), down(down_){ + enable = 0; +} + +void Elevator::go_up() { + enable.period_ms(50); + enable.pulsewidth_us(3500); + Thread::wait(1); + up = 1; + down = 0; +} + +void Elevator::go_down() { + enable.period_ms(50); + enable.pulsewidth_us(400); + Thread::wait(1); + up = 0; + down = 1; +} + +void Elevator::off() { + up = 0; + down = 0; +} +