PRE2015 4 Groep5 Code: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
Line 16: Line 16:


===BaseStation===
===BaseStation===
'''BaseStation.ino'''
/*
  Name: BaseStation.ino
  Created: 5/19/2016 4:07:46 PM
  Author: Use Waterpret
*/
#include <SPI.h>
#define ENABLE_DEBUG
#define BOOKSIZE 10
#define BASESTATION
#ifdef ENABLE_DEBUG
// disable Serial output
#define debugln(a) (Serial.println(a))
#define debug(a) (Serial.print(a))
#else
#define debugln(a)
#define debug(a)
#endif
struct CommandBook
{
char command;
int value;
}tempCommand;
//menu
#include <MenuSystem.h>
#include "CustomNumericMenuItem.h"
// forward declarations
const String format_float(const float value);
const String format_int(const float value);
const String format_color(const float value);
const String format_type(const float value);
const String format_value(const float value);
void display_menu(Menu* p_menu);
void on_status_selected(MenuItem* p_menu_item);
void on_back_item_selected(MenuItem* p_menu_item);
void on_help_selected(MenuItem* p_menu_item);
void on_about_selected(MenuItem* p_menu_item);
void on_add_selected(MenuItem* p_menu_item);
void on_del_selected(MenuItem* p_menu_item);
void on_demo_selected(MenuItem* p_menu_item);
void on_send_selected(MenuItem* p_menu_item);
bool addCommand(CommandBook *book, char command, int value);
int countCommand(CommandBook *book);
void runCommand(CommandBook *book);
void printCommand(CommandBook *book);
bool deleteCommand(CommandBook *book);
bool sendCommand(CommandBook *book);
CommandBook commandos[BOOKSIZE] = {}; // array with commands for the Arduino
// Menu variables
MenuSystem ms;
Menu mm("Main Menu", &display_menu);
Menu muCommand("Command Builder..", &display_menu);
NumericMenuItem muCommand_type("Command type", 0, 0, 11, 1, format_type);
NumericMenuItem muCommand_value("Value", 0, -15, 15, 1, format_value);
MenuItem muCommand_add("Add command to CommandBook", &on_add_selected);
MenuItem muCommand_delete("Delete command from CommandBook", &on_del_selected);
MenuItem muCommand_demo("Set demo sequence", &on_demo_selected);
MenuItem muCommand_send("Send CommandBook to Robot", &on_send_selected);
MenuItem muRobot_status("Status", &on_status_selected);
BackMenuItem mu_back("Back..", &on_back_item_selected, &ms);
MenuItem mm_help("Help", &on_help_selected);
MenuItem mm_about("About", &on_about_selected);
void setup()
{
Serial.begin(9600);
nrf24Initialize(true);
delay(3000);
mm.add_menu(&muCommand);
muCommand.add_item(&muCommand_type);
muCommand.add_item(&muCommand_value);
muCommand.add_item(&muCommand_add);
muCommand.add_item(&muCommand_delete);
muCommand.add_item(&muCommand_demo);
muCommand.add_item(&muCommand_send);
muCommand.add_item(&mu_back);
mm.add_item(&muRobot_status);
mm.add_item(&mm_help);
mm.add_item(&mm_about);
ms.set_root_menu(&mm);
display_help();
ms.display();
}
void loop() {
serial_handler();
}
'''BaseStation.vcxproj'''
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{194F20BC-E954-42EA-99FE-BA4D6577DDA3}</ProjectGuid>
    <RootNamespace>BaseStation</RootNamespace>
    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <IncludePath>$(SolutionDir)Shared;$(IncludePath)</IncludePath>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;C:\Users\s133140\Source\Repos\UseWaterpret\Solution\BaseStation;C:\Users\s133140\Documents\Arduino\libraries\Arduino_Menu;C:\Users\s133140\Documents\Arduino\libraries\Arduino_Menu\utility;C:\Users\s133140\Documents\Arduino\libraries\RadioHead;C:\Users\s133140\Documents\Arduino\libraries\RadioHead\utility;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\default\debuggers;C:\Users\s133140\Documents\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\tools\avr/avr/include/;C:\Program Files (x86)\Arduino\hardware\tools\avr//avr/include/avr/;C:\Program Files (x86)\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ForcedIncludeFiles>C:\Users\s133140\Source\Repos\UseWaterpret\Solution\BaseStation\__vm\.BaseStation.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_DUEMILANOVE;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu\utility;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead\utility;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\zhfqazlz.lqo\Micro Platforms\default\debuggers;C:\Users\Jochem\Documents\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\tools\avr/avr/include/;C:\Program Files (x86)\Arduino\hardware\tools\avr//avr/include/avr/;C:\Program Files (x86)\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ForcedIncludeFiles>C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation\__vm\.BaseStation.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_UNO;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu\utility;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead\utility;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\zhfqazlz.lqo\Micro Platforms\default\debuggers;C:\Users\Jochem\Documents\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\tools\avr/avr/include/;C:\Program Files (x86)\Arduino\hardware\tools\avr//avr/include/avr/;C:\Program Files (x86)\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ForcedIncludeFiles>C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation\__vm\.BaseStation.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <WholeProgramOptimization>false</WholeProgramOptimization>
      <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_UNO;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <None Include="..\Shared\CommandBook.ino" />
    <None Include="..\Shared\nrf24communication.ino" />
    <None Include="BaseStation.ino">
      <FileType>CppCode</FileType>
    </None>
    <None Include="menu.ino" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="CustomNumericMenuItem.h" />
    <ClInclude Include="__vm\.BaseStation.vsarduino.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
  <ProjectExtensions>
    <VisualStudio>
      <UserProperties arduino.upload.maximum_size="30720" arduino.upload.speed="57600" visualmicro.package.name="arduino" arduino.board.property_bag="name=Arduino Duemilanove or Diecimila w/ ATmega328&#xD;&#xA;upload.tool=avrdude&#xD;&#xA;upload.protocol=arduino&#xD;&#xA;bootloader.tool=avrdude&#xD;&#xA;bootloader.low_fuses=0xFF&#xD;&#xA;bootloader.unlock_bits=0x3F&#xD;&#xA;bootloader.lock_bits=0x0F&#xD;&#xA;build.f_cpu=16000000L&#xD;&#xA;build.board=AVR_DUEMILANOVE&#xD;&#xA;build.core=arduino&#xD;&#xA;build.variant=standard&#xD;&#xA;menu.cpu.atmega328=ATmega328&#xD;&#xA;menu.cpu.atmega328.upload.maximum_size=30720&#xD;&#xA;menu.cpu.atmega328.upload.maximum_data_size=2048&#xD;&#xA;menu.cpu.atmega328.upload.speed=57600&#xD;&#xA;menu.cpu.atmega328.bootloader.high_fuses=0xDA&#xD;&#xA;menu.cpu.atmega328.bootloader.extended_fuses=0x05&#xD;&#xA;menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex&#xD;&#xA;menu.cpu.atmega328.build.mcu=atmega328p&#xD;&#xA;menu.cpu.atmega168=ATmega168&#xD;&#xA;menu.cpu.atmega168.upload.maximum_size=14336&#xD;&#xA;menu.cpu.atmega168.upload.maximum_data_size=1024&#xD;&#xA;menu.cpu.atmega168.upload.speed=19200&#xD;&#xA;menu.cpu.atmega168.bootloader.high_fuses=0xdd&#xD;&#xA;menu.cpu.atmega168.bootloader.extended_fuses=0x00&#xD;&#xA;menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex&#xD;&#xA;menu.cpu.atmega168.build.mcu=atmega168&#xD;&#xA;runtime.ide.path=C:\Program Files (x86)\Arduino&#xD;&#xA;build.system.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr\system&#xD;&#xA;runtime.ide.version=10609&#xD;&#xA;target_package=arduino&#xD;&#xA;target_platform=avr&#xD;&#xA;runtime.hardware.path=C:\Program Files (x86)\Arduino\hardware\arduino&#xD;&#xA;originalid=diecimila&#xD;&#xA;intellisense.tools.path={runtime.tools.avr-gcc.path}/&#xD;&#xA;intellisense.include.paths={intellisense.tools.path}avr/include/;{intellisense.tools.path}/avr/include/avr/;{intellisense.tools.path}lib\gcc\avr\4.8.1\include&#xD;&#xA;tools.atprogram.cmd.path=%AVRSTUDIO_EXE_PATH%\atbackend\atprogram&#xD;&#xA;tools.atprogram.cmd.setwinpath=true&#xD;&#xA;tools.atprogram.program.params.verbose=-v&#xD;&#xA;tools.atprogram.program.params.quiet=-q&#xD;&#xA;tools.atprogram.program.pattern=&quot;{cmd.path}&quot; -d {build.mcu} {program.verbose} {program.extra_params} program -c -f &quot;{build.path}\{build.project_name}.hex&quot;&#xD;&#xA;tools.atprogram.program.xpattern=&quot;{cmd.path}&quot; {AVRSTUDIO_BACKEND_CONNECTION} -d {build.mcu} {program.verbose} {program.extra_params} program -c -f &quot;{build.path}\{build.project_name}.hex&quot;&#xD;&#xA;tools.atprogram.erase.params.verbose=-v&#xD;&#xA;tools.atprogram.erase.params.quiet=-q&#xD;&#xA;tools.atprogram.bootloader.params.verbose=-v&#xD;&#xA;tools.atprogram.bootloader.params.quiet=-q&#xD;&#xA;tools.atprogram.bootloader.pattern=&quot;{cmd.path}&quot; -d {build.mcu} {bootloader.verbose}  program -c -f &quot;{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}&quot;&#xD;&#xA;version=1.6.11&#xD;&#xA;compiler.warning_flags=-w&#xD;&#xA;compiler.warning_flags.none=-w&#xD;&#xA;compiler.warning_flags.default=&#xD;&#xA;compiler.warning_flags.more=-Wall&#xD;&#xA;compiler.warning_flags.all=-Wall -Wextra&#xD;&#xA;compiler.path={runtime.tools.avr-gcc.path}/bin/&#xD;&#xA;compiler.c.cmd=avr-gcc&#xD;&#xA;compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD&#xD;&#xA;compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections&#xD;&#xA;compiler.c.elf.cmd=avr-gcc&#xD;&#xA;compiler.S.flags=-c -g -x assembler-with-cpp&#xD;&#xA;compiler.cpp.cmd=avr-g++&#xD;&#xA;compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD&#xD;&#xA;compiler.ar.cmd=avr-ar&#xD;&#xA;compiler.ar.flags=rcs&#xD;&#xA;compiler.objcopy.cmd=avr-objcopy&#xD;&#xA;compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0&#xD;&#xA;compiler.elf2hex.flags=-O ihex -R .eeprom&#xD;&#xA;compiler.elf2hex.cmd=avr-objcopy&#xD;&#xA;compiler.ldflags=&#xD;&#xA;compiler.size.cmd=avr-size&#xD;&#xA;build.extra_flags=&#xD;&#xA;compiler.c.extra_flags=&#xD;&#xA;compiler.c.elf.extra_flags=&#xD;&#xA;compiler.S.extra_flags=&#xD;&#xA;compiler.cpp.extra_flags=&#xD;&#xA;compiler.ar.extra_flags=&#xD;&#xA;compiler.objcopy.eep.extra_flags=&#xD;&#xA;compiler.elf2hex.extra_flags=&#xD;&#xA;recipe.c.o.pattern=&quot;{compiler.path}{compiler.c.cmd}&quot; {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} &quot;{source_file}&quot; -o &quot;{object_file}&quot;&#xD;&#xA;recipe.cpp.o.pattern=&quot;{compiler.path}{compiler.cpp.cmd}&quot; {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} &quot;{source_file}&quot; -o &quot;{object_file}&quot;&#xD;&#xA;recipe.S.o.pattern=&quot;{compiler.path}{compiler.c.cmd}&quot; {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} &quot;{source_file}&quot; -o &quot;{object_file}&quot;&#xD;&#xA;archive_file_path={build.path}/{archive_file}&#xD;&#xA;recipe.ar.pattern=&quot;{compiler.path}{compiler.ar.cmd}&quot; {compiler.ar.flags} {compiler.ar.extra_flags} &quot;{archive_file_path}&quot; &quot;{object_file}&quot;&#xD;&#xA;recipe.c.combine.pattern=&quot;{compiler.path}{compiler.c.elf.cmd}&quot; {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o &quot;{build.path}/{build.project_name}.elf&quot; {object_files} &quot;{build.path}/{archive_file}&quot; &quot;-L{build.path}&quot; -lm&#xD;&#xA;recipe.objcopy.eep.pattern=&quot;{compiler.path}{compiler.objcopy.cmd}&quot; {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} &quot;{build.path}/{build.project_name}.elf&quot; &quot;{build.path}/{build.project_name}.eep&quot;&#xD;&#xA;recipe.objcopy.hex.pattern=&quot;{compiler.path}{compiler.elf2hex.cmd}&quot; {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} &quot;{build.path}/{build.project_name}.elf&quot; &quot;{build.path}/{build.project_name}.hex&quot;&#xD;&#xA;recipe.output.tmp_file={build.project_name}.hex&#xD;&#xA;recipe.output.save_file={build.project_name}.{build.variant}.hex&#xD;&#xA;recipe.size.pattern=&quot;{compiler.path}{compiler.size.cmd}&quot; -A &quot;{build.path}/{build.project_name}.elf&quot;&#xD;&#xA;recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*&#xD;&#xA;recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*&#xD;&#xA;recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*&#xD;&#xA;preproc.includes.flags=-w -x c++ -M -MG -MP&#xD;&#xA;recipe.preproc.includes=&quot;{compiler.path}{compiler.cpp.cmd}&quot; {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} &quot;{source_file}&quot;&#xD;&#xA;preproc.macros.flags=-w -x c++ -E -CC&#xD;&#xA;recipe.preproc.macros=&quot;{compiler.path}{compiler.cpp.cmd}&quot; {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} &quot;{source_file}&quot; -o &quot;{preprocessed_file_path}&quot;&#xD;&#xA;tools.avrdude.path={runtime.tools.avrdude.path}&#xD;&#xA;tools.avrdude.cmd.path={path}/bin/avrdude&#xD;&#xA;tools.avrdude.config.path={path}/etc/avrdude.conf&#xD;&#xA;tools.avrdude.upload.params.verbose=-v&#xD;&#xA;tools.avrdude.upload.params.quiet=-q -q&#xD;&#xA;tools.avrdude.upload.params.noverify=-V&#xD;&#xA;tools.avrdude.upload.pattern=&quot;{cmd.path}&quot; &quot;-C{config.path}&quot; {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D &quot;-Uflash:w:{build.path}/{build.project_name}.hex:i&quot;&#xD;&#xA;tools.avrdude.program.params.verbose=-v&#xD;&#xA;tools.avrdude.program.params.quiet=-q -q&#xD;&#xA;tools.avrdude.program.params.noverify=-V&#xD;&#xA;tools.avrdude.program.pattern=&quot;{cmd.path}&quot; &quot;-C{config.path}&quot; {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} &quot;-Uflash:w:{build.path}/{build.project_name}.hex:i&quot;&#xD;&#xA;tools.avrdude.erase.params.verbose=-v&#xD;&#xA;tools.avrdude.erase.params.quiet=-q -q&#xD;&#xA;tools.avrdude.erase.pattern=&quot;{cmd.path}&quot; &quot;-C{config.path}&quot; {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m&#xD;&#xA;tools.avrdude.bootloader.params.verbose=-v&#xD;&#xA;tools.avrdude.bootloader.params.quiet=-q -q&#xD;&#xA;tools.avrdude.bootloader.pattern=&quot;{cmd.path}&quot; &quot;-C{config.path}&quot; {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} &quot;-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i&quot; -Ulock:w:{bootloader.lock_bits}:m&#xD;&#xA;tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}&#xD;&#xA;build.usb_manufacturer=&quot;Unknown&quot;&#xD;&#xA;build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'&#xD;&#xA;vm.platform.root.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\arduino16x&#xD;&#xA;avrisp.name=AVR ISP&#xD;&#xA;avrisp.communication=serial&#xD;&#xA;avrisp.protocol=stk500v1&#xD;&#xA;avrisp.program.protocol=stk500v1&#xD;&#xA;avrisp.program.tool=avrdude&#xD;&#xA;avrisp.program.extra_params=-P{serial.port}&#xD;&#xA;avrispmkii.name=AVRISP mkII&#xD;&#xA;avrispmkii.communication=usb&#xD;&#xA;avrispmkii.protocol=stk500v2&#xD;&#xA;avrispmkii.program.protocol=stk500v2&#xD;&#xA;avrispmkii.program.tool=avrdude&#xD;&#xA;avrispmkii.program.extra_params=-Pusb&#xD;&#xA;usbtinyisp.name=USBtinyISP&#xD;&#xA;usbtinyisp.protocol=usbtiny&#xD;&#xA;usbtinyisp.program.tool=avrdude&#xD;&#xA;usbtinyisp.program.extra_params=&#xD;&#xA;arduinoisp.name=ArduinoISP&#xD;&#xA;arduinoisp.protocol=arduinoisp&#xD;&#xA;arduinoisp.program.tool=avrdude&#xD;&#xA;arduinoisp.program.extra_params=&#xD;&#xA;usbasp.name=USBasp&#xD;&#xA;usbasp.communication=usb&#xD;&#xA;usbasp.protocol=usbasp&#xD;&#xA;usbasp.program.protocol=usbasp&#xD;&#xA;usbasp.program.tool=avrdude&#xD;&#xA;usbasp.program.extra_params=-Pusb&#xD;&#xA;parallel.name=Parallel Programmer&#xD;&#xA;parallel.protocol=dapa&#xD;&#xA;parallel.force=true&#xD;&#xA;parallel.program.tool=avrdude&#xD;&#xA;parallel.program.extra_params=-F&#xD;&#xA;arduinoasisp.name=Arduino as ISP&#xD;&#xA;arduinoasisp.communication=serial&#xD;&#xA;arduinoasisp.protocol=stk500v1&#xD;&#xA;arduinoasisp.speed=19200&#xD;&#xA;arduinoasisp.program.protocol=stk500v1&#xD;&#xA;arduinoasisp.program.speed=19200&#xD;&#xA;arduinoasisp.program.tool=avrdude&#xD;&#xA;arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}&#xD;&#xA;usbGemma.name=Arduino Gemma&#xD;&#xA;usbGemma.protocol=arduinogemma&#xD;&#xA;usbGemma.program.tool=avrdude&#xD;&#xA;usbGemma.program.extra_params=&#xD;&#xA;usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf&#xD;&#xA;stk500.name=Atmel STK500 development board&#xD;&#xA;stk500.communication=serial&#xD;&#xA;stk500.protocol=stk500&#xD;&#xA;stk500.program.protocol=stk500&#xD;&#xA;stk500.program.tool=avrdude&#xD;&#xA;stk500.program.extra_params=-P{serial.port}&#xD;&#xA;buspirate.name=BusPirate as ISP&#xD;&#xA;buspirate.communication=serial&#xD;&#xA;buspirate.protocol=buspirate&#xD;&#xA;buspirate.program.protocol=buspirate&#xD;&#xA;buspirate.program.tool=avrdude&#xD;&#xA;buspirate.program.extra_params=-P{serial.port}&#xD;&#xA;runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;&#xA;runtime.tools.avrdude-6.0.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;&#xA;runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;&#xA;runtime.tools.avr-gcc-4.8.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;&#xA;upload.maximum_size=30720&#xD;&#xA;upload.maximum_data_size=2048&#xD;&#xA;upload.speed=57600&#xD;&#xA;bootloader.high_fuses=0xDA&#xD;&#xA;bootloader.extended_fuses=0x05&#xD;&#xA;bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex&#xD;&#xA;build.mcu=atmega328p&#xD;&#xA;runtime.vm.boardinfo.id=diecimila_atmega328&#xD;&#xA;runtime.vm.boardinfo.name=diecimila_atmega328&#xD;&#xA;runtime.vm.boardinfo.desc=Arduino Duemilanove or Diecimila w/ ATmega328&#xD;&#xA;runtime.vm.boardinfo.src_location=C:\Program Files (x86)\Arduino\hardware\arduino\avr&#xD;&#xA;ide.hint=For use with Arduino.cc 1.6.2+ ide&#xD;&#xA;ide.location.key=Arduino16x&#xD;&#xA;ide.location.ide.winreg=Arduino 1.6.x Application&#xD;&#xA;ide.location.sketchbook.winreg=Arduino 1.6.x Sketchbook&#xD;&#xA;ide.location.sketchbook.preferences=sketchbook.path&#xD;&#xA;ide.default.revision_name=1.6.9&#xD;&#xA;ide.default.version=10609&#xD;&#xA;ide.default.package=arduino&#xD;&#xA;ide.default.platform=avr&#xD;&#xA;ide.multiplatform=true&#xD;&#xA;ide.includes=arduino.h&#xD;&#xA;ide.exe_name=arduino&#xD;&#xA;ide.platformswithoutpackage=false&#xD;&#xA;ide.includes.fallback=wprogram.h&#xD;&#xA;ide.extension=ino&#xD;&#xA;ide.extension.fallback=pde&#xD;&#xA;ide.versionGTEQ=160&#xD;&#xA;ide.exe=arduino.exe&#xD;&#xA;ide.hosts=atmel&#xD;&#xA;ide.url=http://arduino.cc/en/Main/Software&#xD;&#xA;ide.help.reference.path=reference\arduino.cc\en\Reference&#xD;&#xA;ide.help.reference.path2=reference\www.arduino.cc\en\Reference&#xD;&#xA;ide.help.reference.serial=reference\www.arduino.cc\en\Serial&#xD;&#xA;vm.debug=true&#xD;&#xA;software=ARDUINO&#xD;&#xA;ssh.user.name=root&#xD;&#xA;ssh.user.default.password=arduino&#xD;&#xA;ssh.host.wwwfiles.path=/www/sd&#xD;&#xA;build.working_directory={runtime.ide.path}&#xD;&#xA;ide.location.preferences.portable={runtime.ide.path}\portable&#xD;&#xA;ide.location.preferences=%VM_APPDATA_LOCAL%\arduino15\preferences.txt&#xD;&#xA;ide.location.preferences_fallback=%VM_APPDATA_ROAMING%\arduino15\preferences.txt&#xD;&#xA;ide.location.contributions=%VM_APPDATA_LOCAL%\arduino15&#xD;&#xA;ide.location.contributions_fallback=%VM_APPDATA_ROAMING%\arduino15&#xD;&#xA;ide.contributions.boards.allow=true&#xD;&#xA;ide.contributions.boards.ignore_unless_rewrite_found=true&#xD;&#xA;ide.contributions.libraries.allow=true&#xD;&#xA;ide.contributions.boards.support.urls.wiki=https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls&#xD;&#xA;ide.create_platforms_from_boardsTXT.teensy=build.core&#xD;&#xA;ide.appid=arduino16x&#xD;&#xA;location.sketchbook=C:\Users\s133140\Documents\Arduino&#xD;&#xA;vm.core.include=arduino.h&#xD;&#xA;vm.boardsource.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr&#xD;&#xA;runtime.platform.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr&#xD;&#xA;vm.platformname.name=avr&#xD;&#xA;build.arch=AVR&#xD;&#xA;build.architecture=avr&#xD;&#xA;vmresolved.compiler.path=C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\&#xD;&#xA;vmresolved.tools.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;&#xA;" visualmicro.application.name="arduino16x" arduino.build.mcu="atmega328p" arduino.upload.protocol="arduino" arduino.build.f_cpu="16000000L" arduino.board.desc="Arduino Duemilanove or Diecimila w/ ATmega328" arduino.board.name="diecimila_atmega328" arduino.upload.port="COM4" visualmicro.platform.name="avr" arduino.build.core="arduino" />
    </VisualStudio>
  </ProjectExtensions>
</Project>
'''BaseStation.vcxproj.filters'''
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <None Include="BaseStation.ino" />
    <None Include="..\Shared\nrf24communication.ino" />
    <None Include="menu.ino" />
    <None Include="..\Shared\CommandBook.ino" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="CustomNumericMenuItem.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="__vm\.BaseStation.vsarduino.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
</Project>
'''CustomNumericMenuItem.h'''
/*
  * An example of a custom NumericMenuItem.
  * It tries to display some ASCII graphics in edit mode.
  * This can be useful if you want to give the end user an overview of the value limits.
  *
  * Copyright (c) 2016 arduino-menusystem
  * Licensed under the MIT license (see LICENSE)
  */
#ifndef _CUSTOMNUMERICMENUITEM_H
#define _CUSTOMNUMERICMENUITEM_H
#include <MenuSystem.h>
class CustomNumericMenuItem : public NumericMenuItem
{
public:
    /**
      * @param width the width of the edit mode 'ASCII graphics', must be > 1
      * @param name The name of the menu item.
      * @param value Default value.
      * @param minValue The minimum value.
      * @param maxValue The maximum value.
      * @param increment How much the value should be incremented by.
      * @param valueFormatter The custom formatter. If NULL the String float
      *                      formatter will be used.
      */
    CustomNumericMenuItem(uint8_t width, const char* name, float value,
                          float minValue, float maxValue, float increment=1.0,
                          ValueFormatter_t value_formatter=NULL)
    : NumericMenuItem(name, value, minValue, maxValue, increment,
                      value_formatter),
      _width(width)
    {
    }
    virtual String& get_composite_name(String& buffer) const
    {
        if (is_editing_value())
        {
            // Only display the ASCII graphics in edit mode.
            // make room for a ' ' at the end and the terminating 0
            char graphics[_width + 2];
            // fill the string with '-'
            for (int i = 0; i <_width; i++)
                graphics[i] = '-';
            // insert a '|' at the relative _value position
            graphics[int((_width - 1) * (_value - _minValue) / (_maxValue - _minValue))] = '|';
            graphics[_width] = ' ';
            graphics[_width+1] = 0;
            buffer = graphics;
            if (_value_formatter != NULL)
                buffer += _value_formatter(_value);
            else
                buffer += _value;
            return buffer;
        }
        else
        {
            // Non edit mode: Let parent class handle this
            return NumericMenuItem::get_composite_name(buffer);
        }
    }
private:
    const uint8_t _width;
};
#endif // _CUSTOMNUMERICMENUITEM_H
'''menu.ino'''
/*
* serial_nav.ino - Example code using the menu system library
*
* This example shows the menu system being controlled over the serial port.
*
* Copyright (c) 2015, 2016 arduino-menusystem
* Licensed under the MIT license (see LICENSE)
*/
// Menu callback function
// writes the (int) value of a float into a char buffer.
const String format_int(const float value)
{
return String((int)value);
}
// writes the value of a float into a char buffer.
const String format_float(const float value)
{
return String(value);
}
const String format_type(const float value)
{
String buffer;
switch ((int)value)
{
case 0:
buffer += "Go to plant";
tempCommand.command = 't';
break;
case 1:
buffer += "Grab/cut plant";
tempCommand.command = 'g';
break;
case 2:
buffer += "Clean plant";
tempCommand.command = 'c';
break;
case 3:
buffer += "Return home";
tempCommand.command = 'r';
break;
case 4:
buffer += "Move shaft up";
tempCommand.command = 'W';
break;
case 5:
buffer += "Move shaft down";
tempCommand.command = 'S';
break;
case 6:
buffer += "Extend arm";
tempCommand.command = 'D';
break;
case 7:
buffer += "Retract arm";
tempCommand.command = 'A';
break;
case 8:
buffer += "Move grabber";
tempCommand.command = 'i';
break;
case 9:
buffer += "Move arm";
tempCommand.command = 'u';
break;
case 10:
buffer += "Delay";
tempCommand.command = 'd';
break;
case 11:
buffer += "Move";
tempCommand.command = 'm';
break;
default:
buffer += "undef";
break;
}
return buffer;
}
const String format_value(const float value)
{
tempCommand.value = (int)value;
switch (tempCommand.command) {
case 't':
return "plant " + String(tempCommand.value);
case 'g':
case 'c':
case 'r':
case 'W':
case 'A':
case 'S':
case 'D':
return "N/A";
case 'm':
return String(tempCommand.value * 100) + " steps";
case 'u':
return String(tempCommand.value * 10) + " degrees";
case 'i':
return String(tempCommand.value * 10) + " degrees";
case 'd':
return String(tempCommand.value * 500) + " ms";
default:
return "undef";
}
}
void on_add_selected(MenuItem* p_menu_item)
{
if (!addCommand(commandos, tempCommand.command, tempCommand.value)) {
Serial.println();
Serial.println(F("ERROR:"));
Serial.println(F("Command book full!"));
delay(1000);
}
}
void on_del_selected(MenuItem* p_menu_item)
{
if (!deleteCommand(commandos)) {
Serial.println();
Serial.println(F("ERROR:"));
Serial.println(F("No commands to delete!"));
delay(1000);
}
}
void on_send_selected(MenuItem* p_menu_item)
{
if (!sendCommand(commandos)) {
Serial.println(F("ERROR:"));
Serial.println(F("Could not send commands"));
}
delay(1000);
}
void on_demo_selected(MenuItem* p_menu_item) {
int c = countCommand(commandos);
for (int n = 0; n < c; n += 1) {
deleteCommand(commandos);
}
addCommand(commandos, 't', 1);
addCommand(commandos, 'd', 3000);
addCommand(commandos, 'W', 0);
addCommand(commandos, 'S', 0);
addCommand(commandos, 'd', 3000);
addCommand(commandos, 'D', 0);
addCommand(commandos, 'A', 0);
addCommand(commandos, 'd', 3000);
addCommand(commandos, 'c', 0);
}
void on_help_selected(MenuItem* p_menu_item)
{
display_help();
delay(3000);
}
void on_about_selected(MenuItem* p_menu_item)
{
Serial.println(F("This is the Base Station interface"));
Serial.println(F("which controls the seaweed harvesting"));
Serial.println(F("robot."));
Serial.println();
Serial.println(F("Refer to the USE Social Robots"));
Serial.println(F("2015/2016 Q4 - group 5 wiki for"));
Serial.println(F("more information."));
delay(5000);
}
void on_status_selected(MenuItem* p_menu_item)
{
Serial.println(F("Returning status of the robot:"));
Serial.println(F("------------------------------"));
Serial.print(F("Temperature: "));
Serial.println(F("80"));
Serial.print(F("Max speed (RPM): "));
Serial.println(F("300"));
Serial.print(F("Acceleration: "));
Serial.println(F("80"));
Serial.print(F("Motor1 "));
Serial.println(F("running"));
Serial.print(F("Motor2: "));
Serial.println(F("not running"));
Serial.print(F("Motor3: "));
Serial.println(F("not running"));
Serial.print(F("ServoArm (degrees):"));
Serial.println(F("167"));
Serial.print(F("MotorGrab: "));
Serial.println(F("086"));
delay(3000);
}
void on_back_item_selected(MenuItem* p_menu_item)
{
//
}
void display_menu(Menu* p_menu)
{
Serial.write(27);      // ESC command
Serial.print("[2J");    // clear screen command
Serial.write(27);
Serial.print("[H");    // cursor to home command
Serial.print(F("--[ "));
Serial.print(p_menu->get_name());
Serial.println(F(" ]--"));
String buffer;
MenuComponent const* cp_menu_sel = p_menu->get_current_component();
for (int i = 0; i < p_menu->get_num_menu_components(); ++i)
{
MenuComponent const* cp_m_comp = p_menu->get_menu_component(i);
if (cp_menu_sel == cp_m_comp)
Serial.print("> ");
else
Serial.print("  ");
Serial.print(cp_m_comp->get_composite_name(buffer));
Serial.println("");
}
if (p_menu == &muCommand) {
Serial.println();
printCommand(commandos);
}
}
void display_help() {
Serial.println(F("***************"));
Serial.println(F("w,^:      go to previus item (up)"));
Serial.println(F("s,v:      go to next item (down)"));
Serial.println(F("a,esc:    go back (right)"));
Serial.println(F("d,enter:  select \"selected\" item"));
Serial.println(F("h,?:      print this help"));
Serial.println(F("***************"));
}
void serial_handler()
{
char inChar, inChar2;
if ((inChar = Serial.read()) > 0)
{
switch (inChar)
{
case 27: // control characters
delay(25);
if ((inChar2 = Serial.read()) > 0) {
switch (inChar2) {
case 91: // escaped control characters
delay(25);
switch (Serial.read()) {
case 65: // up
case 90: // shift+tab
case 68: // left
ms.prev();
ms.display();
break;
case 66: // down
case 67: // right
ms.next();
ms.display();
break;
}
break;
case 49: // function keys, just display help.
ms.display();
display_help();
break;
}
}
else { // escape
ms.back();
ms.display();
}
break;
case 'w': // w
// Previous item
ms.prev();
ms.display();
break;
case 's': // s
case 9: // tab
// Next item
ms.next();
ms.display();
break;
case 127: // backspace
case 'a': // a
case 3: // Ctrl+C
// Back presed
ms.back();
ms.display();
break;
case 0x0D: // enter
case ' ': // space
case 'd': // d
// Select presed
ms.select();
ms.display();
break;
case '?': // ?
case 0x0F: // F1
case 'h': // h
// Display help
ms.display();
display_help();
break;
default:
break;
}
}
}
===Robot===
===Robot===
===Shared===
===Shared===

Revision as of 17:00, 16 June 2016

Repository: https://github.com/JochemKuijpers/UseWaterpret

Library

https://github.com/JochemKuijpers/UseWaterpret/tree/master/Library

Libraries used:

  • Arduino_Menu
  • DallasTemperatureControl
  • OneWire
  • RadioHead-1.59
  • ServoTimer2

Solution

BaseStation

BaseStation.ino

/*
 Name:		BaseStation.ino
 Created:	5/19/2016 4:07:46 PM
 Author:	Use Waterpret
*/

#include <SPI.h>

#define ENABLE_DEBUG
#define BOOKSIZE 10
#define BASESTATION

#ifdef ENABLE_DEBUG
// disable Serial output
#define debugln(a) (Serial.println(a))
#define debug(a) (Serial.print(a))
#else
#define debugln(a)
#define debug(a)
#endif

struct CommandBook
{
	char command;
	int value;
}tempCommand;

//menu
#include <MenuSystem.h>
#include "CustomNumericMenuItem.h"

// forward declarations
const String format_float(const float value);
const String format_int(const float value);
const String format_color(const float value);
const String format_type(const float value);
const String format_value(const float value);
void display_menu(Menu* p_menu);
void on_status_selected(MenuItem* p_menu_item);
void on_back_item_selected(MenuItem* p_menu_item);
void on_help_selected(MenuItem* p_menu_item);
void on_about_selected(MenuItem* p_menu_item);
void on_add_selected(MenuItem* p_menu_item);
void on_del_selected(MenuItem* p_menu_item);
void on_demo_selected(MenuItem* p_menu_item);
void on_send_selected(MenuItem* p_menu_item);
bool addCommand(CommandBook *book, char command, int value);
int countCommand(CommandBook *book);
void runCommand(CommandBook *book);
void printCommand(CommandBook *book);
bool deleteCommand(CommandBook *book);
bool sendCommand(CommandBook *book);
CommandBook commandos[BOOKSIZE] = {};				// array with commands for the Arduino

// Menu variables
MenuSystem ms;
Menu mm("Main Menu", &display_menu);
	Menu muCommand("Command Builder..", &display_menu);
		NumericMenuItem muCommand_type("Command type", 0, 0, 11, 1, format_type);
		NumericMenuItem muCommand_value("Value", 0, -15, 15, 1, format_value);
		MenuItem muCommand_add("Add command to CommandBook", &on_add_selected);
		MenuItem muCommand_delete("Delete command from CommandBook", &on_del_selected);
		MenuItem muCommand_demo("Set demo sequence", &on_demo_selected);
		MenuItem muCommand_send("Send CommandBook to Robot", &on_send_selected);
	MenuItem muRobot_status("Status", &on_status_selected);
	BackMenuItem mu_back("Back..", &on_back_item_selected, &ms);
	MenuItem mm_help("Help", &on_help_selected);
	MenuItem mm_about("About", &on_about_selected);

void setup()
{
	Serial.begin(9600);
	nrf24Initialize(true);
	delay(3000);

	mm.add_menu(&muCommand);
		muCommand.add_item(&muCommand_type);
		muCommand.add_item(&muCommand_value);
		muCommand.add_item(&muCommand_add);
		muCommand.add_item(&muCommand_delete);
		muCommand.add_item(&muCommand_demo);
		muCommand.add_item(&muCommand_send);
		muCommand.add_item(&mu_back);
	mm.add_item(&muRobot_status);
	mm.add_item(&mm_help);
	mm.add_item(&mm_about);
	ms.set_root_menu(&mm);

	display_help();
	ms.display();
}

void loop() {
	serial_handler();




}

BaseStation.vcxproj

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{194F20BC-E954-42EA-99FE-BA4D6577DDA3}</ProjectGuid>
    <RootNamespace>BaseStation</RootNamespace>
    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <IncludePath>$(SolutionDir)Shared;$(IncludePath)</IncludePath>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;C:\Users\s133140\Source\Repos\UseWaterpret\Solution\BaseStation;C:\Users\s133140\Documents\Arduino\libraries\Arduino_Menu;C:\Users\s133140\Documents\Arduino\libraries\Arduino_Menu\utility;C:\Users\s133140\Documents\Arduino\libraries\RadioHead;C:\Users\s133140\Documents\Arduino\libraries\RadioHead\utility;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\default\debuggers;C:\Users\s133140\Documents\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\tools\avr/avr/include/;C:\Program Files (x86)\Arduino\hardware\tools\avr//avr/include/avr/;C:\Program Files (x86)\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ForcedIncludeFiles>C:\Users\s133140\Source\Repos\UseWaterpret\Solution\BaseStation\__vm\.BaseStation.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_DUEMILANOVE;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu\utility;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead\utility;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\zhfqazlz.lqo\Micro Platforms\default\debuggers;C:\Users\Jochem\Documents\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\tools\avr/avr/include/;C:\Program Files (x86)\Arduino\hardware\tools\avr//avr/include/avr/;C:\Program Files (x86)\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ForcedIncludeFiles>C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation\__vm\.BaseStation.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_UNO;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard;C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu;C:\Users\Jochem\Documents\Arduino\libraries\Arduino_Menu\utility;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead\utility;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src\utility;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\zhfqazlz.lqo\Micro Platforms\default\debuggers;C:\Users\Jochem\Documents\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\tools\avr/avr/include/;C:\Program Files (x86)\Arduino\hardware\tools\avr//avr/include/avr/;C:\Program Files (x86)\Arduino\hardware\tools\avr/lib\gcc\avr\4.8.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <ForcedIncludeFiles>C:\Users\Jochem\Documents\Projects\UseWaterpret\Solution\BaseStation\__vm\.BaseStation.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
      <WholeProgramOptimization>false</WholeProgramOptimization>
      <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_UNO;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ClCompile>
    <Link>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <None Include="..\Shared\CommandBook.ino" />
    <None Include="..\Shared\nrf24communication.ino" />
    <None Include="BaseStation.ino">
      <FileType>CppCode</FileType>
    </None>
    <None Include="menu.ino" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="CustomNumericMenuItem.h" />
    <ClInclude Include="__vm\.BaseStation.vsarduino.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
  <ProjectExtensions>
    <VisualStudio>
      <UserProperties arduino.upload.maximum_size="30720" arduino.upload.speed="57600" visualmicro.package.name="arduino" arduino.board.property_bag="name=Arduino Duemilanove or Diecimila w/ ATmega328&#xD;
upload.tool=avrdude&#xD;
upload.protocol=arduino&#xD;
bootloader.tool=avrdude&#xD;
bootloader.low_fuses=0xFF&#xD;
bootloader.unlock_bits=0x3F&#xD;
bootloader.lock_bits=0x0F&#xD;
build.f_cpu=16000000L&#xD;
build.board=AVR_DUEMILANOVE&#xD;
build.core=arduino&#xD;
build.variant=standard&#xD;
menu.cpu.atmega328=ATmega328&#xD;
menu.cpu.atmega328.upload.maximum_size=30720&#xD;
menu.cpu.atmega328.upload.maximum_data_size=2048&#xD;
menu.cpu.atmega328.upload.speed=57600&#xD;
menu.cpu.atmega328.bootloader.high_fuses=0xDA&#xD;
menu.cpu.atmega328.bootloader.extended_fuses=0x05&#xD;
menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex&#xD;
menu.cpu.atmega328.build.mcu=atmega328p&#xD;
menu.cpu.atmega168=ATmega168&#xD;
menu.cpu.atmega168.upload.maximum_size=14336&#xD;
menu.cpu.atmega168.upload.maximum_data_size=1024&#xD;
menu.cpu.atmega168.upload.speed=19200&#xD;
menu.cpu.atmega168.bootloader.high_fuses=0xdd&#xD;
menu.cpu.atmega168.bootloader.extended_fuses=0x00&#xD;
menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex&#xD;
menu.cpu.atmega168.build.mcu=atmega168&#xD;
runtime.ide.path=C:\Program Files (x86)\Arduino&#xD;
build.system.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr\system&#xD;
runtime.ide.version=10609&#xD;
target_package=arduino&#xD;
target_platform=avr&#xD;
runtime.hardware.path=C:\Program Files (x86)\Arduino\hardware\arduino&#xD;
originalid=diecimila&#xD;
intellisense.tools.path={runtime.tools.avr-gcc.path}/&#xD;
intellisense.include.paths={intellisense.tools.path}avr/include/;{intellisense.tools.path}/avr/include/avr/;{intellisense.tools.path}lib\gcc\avr\4.8.1\include&#xD;
tools.atprogram.cmd.path=%AVRSTUDIO_EXE_PATH%\atbackend\atprogram&#xD;
tools.atprogram.cmd.setwinpath=true&#xD;
tools.atprogram.program.params.verbose=-v&#xD;
tools.atprogram.program.params.quiet=-q&#xD;
tools.atprogram.program.pattern="{cmd.path}" -d {build.mcu} {program.verbose} {program.extra_params} program -c -f "{build.path}\{build.project_name}.hex"&#xD;
tools.atprogram.program.xpattern="{cmd.path}" {AVRSTUDIO_BACKEND_CONNECTION} -d {build.mcu} {program.verbose} {program.extra_params} program -c -f "{build.path}\{build.project_name}.hex"&#xD;
tools.atprogram.erase.params.verbose=-v&#xD;
tools.atprogram.erase.params.quiet=-q&#xD;
tools.atprogram.bootloader.params.verbose=-v&#xD;
tools.atprogram.bootloader.params.quiet=-q&#xD;
tools.atprogram.bootloader.pattern="{cmd.path}" -d {build.mcu} {bootloader.verbose}  program -c -f "{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}"&#xD;
version=1.6.11&#xD;
compiler.warning_flags=-w&#xD;
compiler.warning_flags.none=-w&#xD;
compiler.warning_flags.default=&#xD;
compiler.warning_flags.more=-Wall&#xD;
compiler.warning_flags.all=-Wall -Wextra&#xD;
compiler.path={runtime.tools.avr-gcc.path}/bin/&#xD;
compiler.c.cmd=avr-gcc&#xD;
compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD&#xD;
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections&#xD;
compiler.c.elf.cmd=avr-gcc&#xD;
compiler.S.flags=-c -g -x assembler-with-cpp&#xD;
compiler.cpp.cmd=avr-g++&#xD;
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD&#xD;
compiler.ar.cmd=avr-ar&#xD;
compiler.ar.flags=rcs&#xD;
compiler.objcopy.cmd=avr-objcopy&#xD;
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0&#xD;
compiler.elf2hex.flags=-O ihex -R .eeprom&#xD;
compiler.elf2hex.cmd=avr-objcopy&#xD;
compiler.ldflags=&#xD;
compiler.size.cmd=avr-size&#xD;
build.extra_flags=&#xD;
compiler.c.extra_flags=&#xD;
compiler.c.elf.extra_flags=&#xD;
compiler.S.extra_flags=&#xD;
compiler.cpp.extra_flags=&#xD;
compiler.ar.extra_flags=&#xD;
compiler.objcopy.eep.extra_flags=&#xD;
compiler.elf2hex.extra_flags=&#xD;
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"&#xD;
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"&#xD;
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"&#xD;
archive_file_path={build.path}/{archive_file}&#xD;
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"&#xD;
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm&#xD;
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"&#xD;
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"&#xD;
recipe.output.tmp_file={build.project_name}.hex&#xD;
recipe.output.save_file={build.project_name}.{build.variant}.hex&#xD;
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"&#xD;
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*&#xD;
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*&#xD;
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*&#xD;
preproc.includes.flags=-w -x c++ -M -MG -MP&#xD;
recipe.preproc.includes="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}"&#xD;
preproc.macros.flags=-w -x c++ -E -CC&#xD;
recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}"&#xD;
tools.avrdude.path={runtime.tools.avrdude.path}&#xD;
tools.avrdude.cmd.path={path}/bin/avrdude&#xD;
tools.avrdude.config.path={path}/etc/avrdude.conf&#xD;
tools.avrdude.upload.params.verbose=-v&#xD;
tools.avrdude.upload.params.quiet=-q -q&#xD;
tools.avrdude.upload.params.noverify=-V&#xD;
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"&#xD;
tools.avrdude.program.params.verbose=-v&#xD;
tools.avrdude.program.params.quiet=-q -q&#xD;
tools.avrdude.program.params.noverify=-V&#xD;
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} {program.verify} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"&#xD;
tools.avrdude.erase.params.verbose=-v&#xD;
tools.avrdude.erase.params.quiet=-q -q&#xD;
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m&#xD;
tools.avrdude.bootloader.params.verbose=-v&#xD;
tools.avrdude.bootloader.params.quiet=-q -q&#xD;
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m&#xD;
tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}&#xD;
build.usb_manufacturer="Unknown"&#xD;
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'&#xD;
vm.platform.root.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\arduino16x&#xD;
avrisp.name=AVR ISP&#xD;
avrisp.communication=serial&#xD;
avrisp.protocol=stk500v1&#xD;
avrisp.program.protocol=stk500v1&#xD;
avrisp.program.tool=avrdude&#xD;
avrisp.program.extra_params=-P{serial.port}&#xD;
avrispmkii.name=AVRISP mkII&#xD;
avrispmkii.communication=usb&#xD;
avrispmkii.protocol=stk500v2&#xD;
avrispmkii.program.protocol=stk500v2&#xD;
avrispmkii.program.tool=avrdude&#xD;
avrispmkii.program.extra_params=-Pusb&#xD;
usbtinyisp.name=USBtinyISP&#xD;
usbtinyisp.protocol=usbtiny&#xD;
usbtinyisp.program.tool=avrdude&#xD;
usbtinyisp.program.extra_params=&#xD;
arduinoisp.name=ArduinoISP&#xD;
arduinoisp.protocol=arduinoisp&#xD;
arduinoisp.program.tool=avrdude&#xD;
arduinoisp.program.extra_params=&#xD;
usbasp.name=USBasp&#xD;
usbasp.communication=usb&#xD;
usbasp.protocol=usbasp&#xD;
usbasp.program.protocol=usbasp&#xD;
usbasp.program.tool=avrdude&#xD;
usbasp.program.extra_params=-Pusb&#xD;
parallel.name=Parallel Programmer&#xD;
parallel.protocol=dapa&#xD;
parallel.force=true&#xD;
parallel.program.tool=avrdude&#xD;
parallel.program.extra_params=-F&#xD;
arduinoasisp.name=Arduino as ISP&#xD;
arduinoasisp.communication=serial&#xD;
arduinoasisp.protocol=stk500v1&#xD;
arduinoasisp.speed=19200&#xD;
arduinoasisp.program.protocol=stk500v1&#xD;
arduinoasisp.program.speed=19200&#xD;
arduinoasisp.program.tool=avrdude&#xD;
arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}&#xD;
usbGemma.name=Arduino Gemma&#xD;
usbGemma.protocol=arduinogemma&#xD;
usbGemma.program.tool=avrdude&#xD;
usbGemma.program.extra_params=&#xD;
usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf&#xD;
stk500.name=Atmel STK500 development board&#xD;
stk500.communication=serial&#xD;
stk500.protocol=stk500&#xD;
stk500.program.protocol=stk500&#xD;
stk500.program.tool=avrdude&#xD;
stk500.program.extra_params=-P{serial.port}&#xD;
buspirate.name=BusPirate as ISP&#xD;
buspirate.communication=serial&#xD;
buspirate.protocol=buspirate&#xD;
buspirate.program.protocol=buspirate&#xD;
buspirate.program.tool=avrdude&#xD;
buspirate.program.extra_params=-P{serial.port}&#xD;
runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;
runtime.tools.avrdude-6.0.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;
runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;
runtime.tools.avr-gcc-4.8.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;
upload.maximum_size=30720&#xD;
upload.maximum_data_size=2048&#xD;
upload.speed=57600&#xD;
bootloader.high_fuses=0xDA&#xD;
bootloader.extended_fuses=0x05&#xD;
bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex&#xD;
build.mcu=atmega328p&#xD;
runtime.vm.boardinfo.id=diecimila_atmega328&#xD;
runtime.vm.boardinfo.name=diecimila_atmega328&#xD;
runtime.vm.boardinfo.desc=Arduino Duemilanove or Diecimila w/ ATmega328&#xD;
runtime.vm.boardinfo.src_location=C:\Program Files (x86)\Arduino\hardware\arduino\avr&#xD;
ide.hint=For use with Arduino.cc 1.6.2+ ide&#xD;
ide.location.key=Arduino16x&#xD;
ide.location.ide.winreg=Arduino 1.6.x Application&#xD;
ide.location.sketchbook.winreg=Arduino 1.6.x Sketchbook&#xD;
ide.location.sketchbook.preferences=sketchbook.path&#xD;
ide.default.revision_name=1.6.9&#xD;
ide.default.version=10609&#xD;
ide.default.package=arduino&#xD;
ide.default.platform=avr&#xD;
ide.multiplatform=true&#xD;
ide.includes=arduino.h&#xD;
ide.exe_name=arduino&#xD;
ide.platformswithoutpackage=false&#xD;
ide.includes.fallback=wprogram.h&#xD;
ide.extension=ino&#xD;
ide.extension.fallback=pde&#xD;
ide.versionGTEQ=160&#xD;
ide.exe=arduino.exe&#xD;
ide.hosts=atmel&#xD;
ide.url=http://arduino.cc/en/Main/Software�%0Aide.help.reference.path=reference\arduino.cc\en\Reference�%0Aide.help.reference.path2=reference\www.arduino.cc\en\Reference�%0Aide.help.reference.serial=reference\www.arduino.cc\en\Serial�%0Avm.debug=true�%0Asoftware=ARDUINO�%0Assh.user.name=root�%0Assh.user.default.password=arduino�%0Assh.host.wwwfiles.path=/www/sd�%0Abuild.working_directory={runtime.ide.path}�%0Aide.location.preferences.portable={runtime.ide.path}\portable�%0Aide.location.preferences=%VM_APPDATA_LOCAL%\arduino15\preferences.txt�%0Aide.location.preferences_fallback=%VM_APPDATA_ROAMING%\arduino15\preferences.txt�%0Aide.location.contributions=%VM_APPDATA_LOCAL%\arduino15�%0Aide.location.contributions_fallback=%VM_APPDATA_ROAMING%\arduino15�%0Aide.contributions.boards.allow=true�%0Aide.contributions.boards.ignore_unless_rewrite_found=true�%0Aide.contributions.libraries.allow=true�%0Aide.contributions.boards.support.urls.wiki=https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls�%0Aide.create_platforms_from_boardsTXT.teensy=build.core�%0Aide.appid=arduino16x�%0Alocation.sketchbook=C:\Users\s133140\Documents\Arduino�%0Avm.core.include=arduino.h�%0Avm.boardsource.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr&#xD;
runtime.platform.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr&#xD;
vm.platformname.name=avr&#xD;
build.arch=AVR&#xD;
build.architecture=avr&#xD;
vmresolved.compiler.path=C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\&#xD;
vmresolved.tools.path=C:\Program Files (x86)\Arduino\hardware\tools\avr&#xD;
" visualmicro.application.name="arduino16x" arduino.build.mcu="atmega328p" arduino.upload.protocol="arduino" arduino.build.f_cpu="16000000L" arduino.board.desc="Arduino Duemilanove or Diecimila w/ ATmega328" arduino.board.name="diecimila_atmega328" arduino.upload.port="COM4" visualmicro.platform.name="avr" arduino.build.core="arduino" />
    </VisualStudio>
  </ProjectExtensions>
</Project>

BaseStation.vcxproj.filters

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <None Include="BaseStation.ino" />
    <None Include="..\Shared\nrf24communication.ino" />
    <None Include="menu.ino" />
    <None Include="..\Shared\CommandBook.ino" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="CustomNumericMenuItem.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="__vm\.BaseStation.vsarduino.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
</Project>

CustomNumericMenuItem.h

/*
 * An example of a custom NumericMenuItem.
 * It tries to display some ASCII graphics in edit mode.
 * This can be useful if you want to give the end user an overview of the value limits.
 * 
 * Copyright (c) 2016 arduino-menusystem
 * Licensed under the MIT license (see LICENSE)
 */

#ifndef _CUSTOMNUMERICMENUITEM_H
#define _CUSTOMNUMERICMENUITEM_H

#include <MenuSystem.h>

class CustomNumericMenuItem : public NumericMenuItem
{
public:
    /**
     * @param width the width of the edit mode 'ASCII graphics', must be > 1
     * @param name The name of the menu item.
     * @param value Default value.
     * @param minValue The minimum value.
     * @param maxValue The maximum value.
     * @param increment How much the value should be incremented by.
     * @param valueFormatter The custom formatter. If NULL the String float
     *                       formatter will be used.
     */
    CustomNumericMenuItem(uint8_t width, const char* name, float value,
                          float minValue, float maxValue, float increment=1.0,
                          ValueFormatter_t value_formatter=NULL)
    : NumericMenuItem(name, value, minValue, maxValue, increment,
                      value_formatter),
      _width(width)
    {
    }

    virtual String& get_composite_name(String& buffer) const
    {
        if (is_editing_value())
        {
            // Only display the ASCII graphics in edit mode.

            // make room for a ' ' at the end and the terminating 0
            char graphics[_width + 2];
            // fill the string with '-'
            for (int i = 0; i <_width; i++)
                graphics[i] = '-';
            // insert a '|' at the relative _value position
            graphics[int((_width - 1) * (_value - _minValue) / (_maxValue - _minValue))] = '|';
            graphics[_width] = ' ';
            graphics[_width+1] = 0;
            buffer = graphics;

            if (_value_formatter != NULL)
                buffer += _value_formatter(_value);
            else
                buffer += _value;
            return buffer;
        }
        else
        {
            // Non edit mode: Let parent class handle this
            return NumericMenuItem::get_composite_name(buffer);
        }
    }

private:
    const uint8_t _width;
};

#endif // _CUSTOMNUMERICMENUITEM_H

menu.ino

/*
* serial_nav.ino - Example code using the menu system library
*
* This example shows the menu system being controlled over the serial port.
*
* Copyright (c) 2015, 2016 arduino-menusystem
* Licensed under the MIT license (see LICENSE)
*/

// Menu callback function

// writes the (int) value of a float into a char buffer.
const String format_int(const float value)
{
	return String((int)value);
}

// writes the value of a float into a char buffer.
const String format_float(const float value)
{
	return String(value);
}

const String format_type(const float value)
{
	String buffer;

	switch ((int)value)
	{
	case 0:
		buffer += "Go to plant";
		tempCommand.command = 't';
		break;
	case 1:
		buffer += "Grab/cut plant";
		tempCommand.command = 'g';
		break;
	case 2:
		buffer += "Clean plant";
		tempCommand.command = 'c';
		break;
	case 3:
		buffer += "Return home";
		tempCommand.command = 'r';
		break;
	case 4:
		buffer += "Move shaft up";
		tempCommand.command = 'W';
		break;
	case 5:
		buffer += "Move shaft down";
		tempCommand.command = 'S';
		break;
	case 6:
		buffer += "Extend arm";
		tempCommand.command = 'D';
		break;
	case 7:
		buffer += "Retract arm";
		tempCommand.command = 'A';
		break;
	case 8:
		buffer += "Move grabber";
		tempCommand.command = 'i';
		break;
	case 9:
		buffer += "Move arm";
		tempCommand.command = 'u';
		break;
	case 10:
		buffer += "Delay";
		tempCommand.command = 'd';
		break;
	case 11:
		buffer += "Move";
		tempCommand.command = 'm';
		break;
	default:
		buffer += "undef";
		break;
	}

	return buffer;
}

const String format_value(const float value)
{
	tempCommand.value = (int)value;

	switch (tempCommand.command) {
	case 't':
		return "plant " + String(tempCommand.value);
	case 'g':
	case 'c':
	case 'r':
	case 'W':
	case 'A':
	case 'S':
	case 'D':
		return "N/A";
	case 'm':
		return String(tempCommand.value * 100) + " steps";
	case 'u':
		return String(tempCommand.value * 10) + " degrees";
	case 'i':
		return String(tempCommand.value * 10) + " degrees";
	case 'd':
		return String(tempCommand.value * 500) + " ms";
	default:
		return "undef";
	}
}

void on_add_selected(MenuItem* p_menu_item)
{
	if (!addCommand(commandos, tempCommand.command, tempCommand.value)) {
		Serial.println();
		Serial.println(F("ERROR:"));
		Serial.println(F("Command book full!"));
		delay(1000);
	}
}

void on_del_selected(MenuItem* p_menu_item)
{
	if (!deleteCommand(commandos)) {
		Serial.println();
		Serial.println(F("ERROR:"));
		Serial.println(F("No commands to delete!"));
		delay(1000);
	}
}

void on_send_selected(MenuItem* p_menu_item)
{
	if (!sendCommand(commandos)) {
		Serial.println(F("ERROR:"));
		Serial.println(F("Could not send commands"));
	}

	delay(1000);
}

void on_demo_selected(MenuItem* p_menu_item) {
	int c = countCommand(commandos);
	for (int n = 0; n < c; n += 1) {
		deleteCommand(commandos);
	}
	addCommand(commandos, 't', 1);
	addCommand(commandos, 'd', 3000);
	addCommand(commandos, 'W', 0);
	addCommand(commandos, 'S', 0);
	addCommand(commandos, 'd', 3000);
	addCommand(commandos, 'D', 0);
	addCommand(commandos, 'A', 0);
	addCommand(commandos, 'd', 3000);
	addCommand(commandos, 'c', 0);
}

void on_help_selected(MenuItem* p_menu_item)
{
	display_help();
	delay(3000);
}

void on_about_selected(MenuItem* p_menu_item)
{
	Serial.println(F("This is the Base Station interface"));
	Serial.println(F("which controls the seaweed harvesting"));
	Serial.println(F("robot."));
	Serial.println();
	Serial.println(F("Refer to the USE Social Robots"));
	Serial.println(F("2015/2016 Q4 - group 5 wiki for"));
	Serial.println(F("more information."));
	delay(5000);
}


void on_status_selected(MenuItem* p_menu_item)
{
	Serial.println(F("Returning status of the robot:"));
	Serial.println(F("------------------------------"));
	Serial.print(F("Temperature: "));
	Serial.println(F("80"));
	Serial.print(F("Max speed (RPM): "));
	Serial.println(F("300"));
	Serial.print(F("Acceleration: "));
	Serial.println(F("80"));
	Serial.print(F("Motor1 "));
	Serial.println(F("running"));
	Serial.print(F("Motor2: "));
	Serial.println(F("not running"));
	Serial.print(F("Motor3: "));
	Serial.println(F("not running"));
	Serial.print(F("ServoArm (degrees):"));
	Serial.println(F("167"));
	Serial.print(F("MotorGrab: "));
	Serial.println(F("086"));
	delay(3000);
}

void on_back_item_selected(MenuItem* p_menu_item)
{
	//
}

void display_menu(Menu* p_menu)
{
	Serial.write(27);       // ESC command
	Serial.print("[2J");    // clear screen command
	Serial.write(27);
	Serial.print("[H");     // cursor to home command
	Serial.print(F("--[ "));
	Serial.print(p_menu->get_name());
	Serial.println(F(" ]--"));

	String buffer;
	MenuComponent const* cp_menu_sel = p_menu->get_current_component();
	for (int i = 0; i < p_menu->get_num_menu_components(); ++i)
	{
		MenuComponent const* cp_m_comp = p_menu->get_menu_component(i);
		if (cp_menu_sel == cp_m_comp)
			Serial.print("> ");
		else
			Serial.print("  ");
		Serial.print(cp_m_comp->get_composite_name(buffer));

		Serial.println("");
	}

	if (p_menu == &muCommand) {
		Serial.println();
		printCommand(commandos);
	}
}


void display_help() {
	Serial.println(F("***************"));
	Serial.println(F("w,^:      go to previus item (up)"));
	Serial.println(F("s,v:      go to next item (down)"));
	Serial.println(F("a,esc:    go back (right)"));
	Serial.println(F("d,enter:  select \"selected\" item"));
	Serial.println(F("h,?:      print this help"));
	Serial.println(F("***************"));
}

void serial_handler()
{
	char inChar, inChar2;

	if ((inChar = Serial.read()) > 0)
	{
		switch (inChar)
		{
		case 27: // control characters
			delay(25);
			if ((inChar2 = Serial.read()) > 0) {
				switch (inChar2) {
				case 91: // escaped control characters
					delay(25);
					switch (Serial.read()) {
					case 65: // up
					case 90: // shift+tab
					case 68: // left
						ms.prev();
						ms.display();
						break;
					case 66: // down
					case 67: // right
						ms.next();
						ms.display();
						break;
					}
					break;
				case 49: // function keys, just display help.
					ms.display();
					display_help();
					break;
				}
			}
			else { // escape
				ms.back();
				ms.display();
			}
			break;

		case 'w': // w
			// Previous item
			ms.prev();
			ms.display();
			break;
		case 's': // s
		case 9: // tab
			// Next item
			ms.next();
			ms.display();
			break;
		case 127: // backspace
		case 'a': // a
		case 3: // Ctrl+C
			// Back presed
			ms.back();
			ms.display();
			break;
		case 0x0D: // enter
		case ' ': // space
		case 'd': // d
			// Select presed
			ms.select();
			ms.display();
			break;
		case '?': // ?
		case 0x0F: // F1
		case 'h': // h
			// Display help
			ms.display();
			display_help();
			break;
		default:
			break;
		}
	}
}

Robot

Shared

Solution.sln

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Robot", "Robot\Robot.vcxproj", "{E107B750-A178-4195-BCF5-E1DADA3D52A1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseStation", "BaseStation\BaseStation.vcxproj", "{194F20BC-E954-42EA-99FE-BA4D6577DDA3}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|x64 = Debug|x64
		Debug|x86 = Debug|x86
		Release|x64 = Release|x64
		Release|x86 = Release|x86
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{E107B750-A178-4195-BCF5-E1DADA3D52A1}.Debug|x64.ActiveCfg = Debug|Win32
		{E107B750-A178-4195-BCF5-E1DADA3D52A1}.Debug|x86.ActiveCfg = Debug|Win32
		{E107B750-A178-4195-BCF5-E1DADA3D52A1}.Debug|x86.Build.0 = Debug|Win32
		{E107B750-A178-4195-BCF5-E1DADA3D52A1}.Release|x64.ActiveCfg = Release|Win32
		{E107B750-A178-4195-BCF5-E1DADA3D52A1}.Release|x86.ActiveCfg = Release|Win32
		{E107B750-A178-4195-BCF5-E1DADA3D52A1}.Release|x86.Build.0 = Release|Win32
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Debug|x64.ActiveCfg = Debug|x64
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Debug|x64.Build.0 = Debug|x64
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Debug|x86.ActiveCfg = Debug|Win32
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Debug|x86.Build.0 = Debug|Win32
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Release|x64.ActiveCfg = Release|x64
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Release|x64.Build.0 = Release|x64
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Release|x86.ActiveCfg = Release|Win32
		{194F20BC-E954-42EA-99FE-BA4D6577DDA3}.Release|x86.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal