firstaa
Dependents: 17robo_fuzi 17robo_tokyo_kaede
Diff: cylinder.cpp
- Revision:
- 0:46dd0245886c
- Child:
- 1:d4fa6f96bab5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cylinder.cpp Wed Sep 20 07:09:56 2017 +0000 @@ -0,0 +1,25 @@ +#include "cylinder.h" +#include "mbed.h" + +Cylinder::Cylinder(PinName pin_in,PinName pin_out):cylinder_in(pin_in),cylinder_out(pin_out){ + cylinder_in = 1; + cylinder_out = 0; +} + +void Cylinder::cyclic(int state){ + if(state) { + if(flag == false) { + cylinder_in = !cylinder_in; + cylinder_out = !cylinder_out; + } + flag = true; + } else flag = false; +} + +int Cylinder::getInState(){ + return (int)cylinder_in; +} + +int Cylinder::getOutState(){ + return (int)cylinder_out; +} \ No newline at end of file