NerfUS mobile node that manages a target for the Nerf gun firing range
Dependencies: LedController mbed-rtos mbed NerfUSXbee Servomotor TargetManager
Fork of NerfUS by
Diff: source/Target.cpp
- Revision:
- 18:353fb432c03c
- Child:
- 19:377887760869
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/Target.cpp Wed Mar 08 12:24:17 2017 -0500 @@ -0,0 +1,33 @@ +#include "Target.hpp" + + +Target::Target(ServomotorInterface& servomotor, LedControllerInterface& led_controller): + servomotor(servomotor), + led_controller(led_controller) +{ +} + +void Target::execute_command(Mode mode, int timeout_ms) +{ + if(mode == Ally) + { + ally_command(); + } + else + { + enemy_command(); + } +} + + +void Target::ally_command() +{ + servomotor.set_position_up(); +} + +void Target::enemy_command() +{ + led_controller.turn_on(); + servomotor.set_position_up(); +} +