Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "BWander.h"
- BWander::BWander()
- {}
- //tasks
- // 0 - stop
- // 1 - foreward
- void BWander::init()
- {
- //Serial.println("***************************BWander.init() ");
- last = timer.getTime();
- going = false;
- addTask(new Stop());
- addTask(new Forward());
- }
- void BWander::execute()
- {
- //Serial.println("BWander.execute() taskcount: " + (String)taskCount);
- if ((timer.getTime() - last) > 3000)
- {
- going = !going;
- last = timer.getTime();
- }
- if (going)
- {
- Serial.println("go!");
- tasks[1]->execute();
- }
- else
- {
- Serial.println("stop!");
- tasks[0]->execute();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment