Create library
Diff: toggle.cpp
- Revision:
- 0:b12b22c76c4d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toggle.cpp Mon Dec 07 21:02:16 2020 +0000 @@ -0,0 +1,16 @@ +#include "toggle.h" + + + +Toggle::Toggle(PinName pin) : _p(pin) +{ + _p = 0; +} + +void Toggle::toggle(int n) +{ + for(int i=0; i<n*2; i++) { + _p = !_p; + wait(0.2); + } +}