first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
Diff: cyclic_io.cpp
- Revision:
- 0:3555e86bf40d
- Child:
- 1:e0bcbeb71a97
diff -r 000000000000 -r 3555e86bf40d cyclic_io.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cyclic_io.cpp Wed Sep 20 07:09:50 2017 +0000 @@ -0,0 +1,18 @@ +#include "cyclic_io.h" +#include "mbed.h" + +CyclicIo::CyclicIo(PinName pin) : gpio(pin){ +} + +void CyclicIo::cyclic(int state){ + if(state) { + if(flag == false) { + gpio = !gpio; + } + flag = true; + } else flag = false; +} + +int CyclicIo::getState(){ + return (int)gpio; +} \ No newline at end of file