Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LedController mbed-rtos mbed NerfUSXbee Servomotor TargetManager
Fork of NerfUS by
Target.hpp
00001 #ifndef TARGET_HPP 00002 #define TARGET_HPP 00003 00004 #include "ServomotorInterface.hpp" 00005 #include "LedControllerInterface.hpp" 00006 #include "XbeeTransmitterInterface.hpp" 00007 #include "TargetInterface.hpp" 00008 00009 #include "stdint.h" 00010 00011 extern int coordinator_address[]; 00012 00013 class Target : public TargetInterface 00014 { 00015 public: 00016 enum Result 00017 { 00018 RESULT_HIT, 00019 RESULT_MISSED 00020 }; 00021 00022 enum Mode 00023 { 00024 Ally, 00025 Enemy 00026 }; 00027 00028 Target(ServomotorInterface &servomotor, 00029 LedControllerInterface &ally_leds, 00030 LedControllerInterface &enemy_leds, 00031 XbeeTransmitterInterface &xbee_transmitter, 00032 int target_number); 00033 void execute_command(Mode mode, int timeout_ms); 00034 virtual void ally_command(); 00035 virtual void enemy_command(); 00036 void generate_message(uint8_t target_number, Result result, uint16_t time_taken_ms, uint8_t* message) const; 00037 virtual void timeout(int time_taken_ms); 00038 virtual void hit(int time_taken_ms); 00039 00040 private: 00041 ServomotorInterface &servomotor; 00042 LedControllerInterface &ally_leds; 00043 LedControllerInterface &enemy_leds; 00044 XbeeTransmitterInterface &xbee_transmitter; 00045 const int target_number; 00046 }; 00047 00048 #endif
Generated on Thu Jul 14 2022 01:50:39 by
1.7.2
