first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
Revision 0:2cff474c9122, committed 2017-09-20
- Comitter:
- echo_piyo
- Date:
- Wed Sep 20 07:09:40 2017 +0000
- Commit message:
- 1??
Changed in this revision
cyclic_var.cpp | Show annotated file Show diff for this revision Revisions of this file |
cyclic_var.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cyclic_var.cpp Wed Sep 20 07:09:40 2017 +0000 @@ -0,0 +1,15 @@ +#include "cyclic_var.h" +#include "mbed.h" + +void CyclicVar::cyclic(int state_in){ + if(state_in) { + if(flag == false) { + state = !state; + } + flag = true; + } else flag = false; +} + +int CyclicVar::getState(){ + return state; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cyclic_var.h Wed Sep 20 07:09:40 2017 +0000 @@ -0,0 +1,29 @@ +/* + * [CyclicVar] + * **任意の<int>0/1状態(sbdbtのボタン)を受け渡すことで、サイクリックし状態を<int>で返す + * + * [Public Member Functions] + * CyclicVar(PinName pin) + * **<Create> 宣言 + * int cyclic(int state) + * **0/1で状態を入力 + * int getState() + * **サイクリックの状態を出力 + */ + +#ifndef MBED_CYCLIC_VAR_H +#define MBED_CYCLIC_VAR_H + +#include "mbed.h" + +class CyclicVar{ + public: + void cyclic(int state_in); + int getState(); + + private: + bool flag; + bool state; +}; + +#endif \ No newline at end of file