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 NerfUS

source/Target.cpp

Committer:
Maxime Dupuis
Date:
2017-03-08
Revision:
18:353fb432c03c
Child:
19:377887760869

File content as of revision 18:353fb432c03c:

#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();
}