![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
my new gear...
control_theory/nap.cpp
- Committer:
- yootee
- Date:
- 2022-03-27
- Revision:
- 3:a9b4b2565a23
- Parent:
- nap.cpp@ 0:1456b6f84c75
- Child:
- 6:e7f2335456c8
File content as of revision 3:a9b4b2565a23:
#include <nap.hpp> NAP::NAP(float nap_time):nap_time_(nap_time){ restart(); } void NAP::take_a_nap(){ while((now_time - prev_time) < (nap_time_*1000)){ now_time = nap.read_ms(); } prev_time = now_time; } void NAP::setNaptime(float nap_time){ nap_time_ = nap_time; } void NAP::restart(){ nap.reset(); nap.start(); now_time = 0; prev_time = 0; }