PRE2015 4 Groep5 Code: Difference between revisions
Jump to navigation
Jump to search
(→Shared) |
No edit summary |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Repository: https://github.com/ | Repository: https://github.com/Petzep/UseWaterpret | ||
== | ==Repository== | ||
===Library=== | |||
Libraries used: | Libraries used: | ||
Line 13: | Line 13: | ||
* ServoTimer2 | * ServoTimer2 | ||
==Solution== | ===Solution=== | ||
===BaseStation=== | '''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 | |||
====BaseStation==== | |||
'''BaseStation.ino''' | '''BaseStation.ino''' | ||
Line 701: | Line 739: | ||
} | } | ||
===Robot=== | ====Robot==== | ||
===Shared=== | |||
'''CommandBook.ino''' | |||
int countCommand(CommandBook *book) | |||
{ | |||
int c = 0; | |||
while (book[c].command != NULL && c < BOOKSIZE) | |||
c++; | |||
return c; | |||
} | |||
void addCommand(CommandBook *book, char command, int value) | |||
{ | |||
int c = countCommand(book); | |||
book[c].command = command; | |||
book[c].value = value; | |||
} | |||
void runCommand(CommandBook *book) | |||
{ | |||
int c = countCommand(book); | |||
for (int i = 0; i < c; i++) | |||
{ | |||
switch (book[i].command) | |||
{ | |||
case 'm': | |||
{ | |||
myStepper.move(book[i].value); | |||
while (myStepper.distanceToGo()) | |||
myStepper.run(); | |||
myStepper.disableOutputs(); | |||
break; | |||
} | |||
case 'd': | |||
{ | |||
delay(book[i].value); | |||
break; | |||
} | |||
default: | |||
{ | |||
Serial.println("Invaild command!"); | |||
break; | |||
} | |||
} | |||
book[i].command = NULL; | |||
book[i].value = NULL; | |||
} | |||
} | |||
void printCommand(CommandBook *book) | |||
{ | |||
int c = countCommand(book); | |||
Serial.println("Commandos in book:"); | |||
for (int i = 0; i < c; i++) | |||
{ | |||
Serial.print('-'); | |||
Serial.print(book[i].command); | |||
Serial.print('\t'); | |||
Serial.println(book[i].value); | |||
} | |||
Serial.println("Done"); | |||
} | |||
'''Robot.ino''' | |||
/* | |||
Name: Robot.ino | |||
Created: 5/19/2016 4:07:57 PM | |||
Author: Use Waterpret | |||
*/ | |||
#define Servo ServoTimer2 | |||
//#define ENABLE_DEBUG | |||
//#define REMOTE | |||
#define BOOKSIZE 20 | |||
struct CommandBook | |||
{ | |||
char command; | |||
int value; | |||
}; | |||
#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 | |||
#include <Arduino.h> // Fixes some define problems | |||
#include <ServoTimer2.h> // Include servo library | |||
#include <AccelStepper.h> // AccelStepper library for precise and fluid steppercontrol | |||
#include <SPI.h> // The SPI-communication liberary for the antenna | |||
#include <OneWire\OneWire.h> // The OneWire-protocol used by te temp sensor | |||
#include <DallasTemperatureControl\DallasTemperature.h> // DallasTemperature library for controlling the DS18S20 temperature monitor | |||
OneWire oneWire(A0); // Setup a oneWire instance to communicate with any OneWire devices | |||
DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. | |||
AccelStepper shaftStepper(AccelStepper::FULL4WIRE, 13, 12, 11, 9, TRUE);// initialize the stepper library on pins 13,12,11,9 and disable the output; | |||
AccelStepper kopStepper(AccelStepper::FULL4WIRE, 2, 4, 6, 7, FALSE); // initialize the stepper library on pins 2,4,6,7 and disable the output; | |||
AccelStepper armStepper(AccelStepper::FULL4WIRE, A2, A3, A4, A5, FALSE);// initialize the stepper library on pins A2,A3,A4,A5 and disable the output; | |||
CommandBook commandos[BOOKSIZE] = {}; // array with commands for the Arduino | |||
DeviceAddress motorShaftTemp; // arrays to hold device addresses of the TempSensors | |||
Servo servoArm; // Arm servo signal | |||
Servo servoGrab; // Grabbbing Servo | |||
const int delayRest = 100; // Standard delay for momentum to stablelize | |||
const int armNeutralPosition = 90; // Neutral position of the grabber | |||
const int grabberNeutralPosition = 60; // Ground position of the grabber | |||
const int grabberGrabPosition = 0; // Position for closed grabbers | |||
const int armOffset = 0; // turn ofset for the head in degrees | |||
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution for your motor | |||
const int acceleration = 350; // Acceleration | |||
const float pi = 3.141592654; // this one is a piece of cake | |||
int kopSpeed = 0; // Speed of the kopmotor in RPM | |||
char motorDirection = 1; // direction of the motor | |||
unsigned long previousMillis = 0; // will store last time LED was updatedvccv | |||
float rpm2steps = stepsPerRevolution / 60.0f; | |||
uint8_t* buf = new uint8_t[32]; | |||
uint8_t len = 32; | |||
void r_RPMtester(AccelStepper driver); // Small acceleration test. | |||
void r_DirectionTest(); // Small direction test. | |||
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); | |||
///////////////////////////////// | |||
///USER DETERMINED VARIABLES///// | |||
///////////////////////////////// | |||
int armPos = armNeutralPosition; | |||
int grabPos = grabberNeutralPosition; | |||
int remoteStep = 5; | |||
void setup() // Built in initialization block | |||
{ | |||
Serial.begin(9600); // open the serial port at 9600 bps: | |||
Serial.println(F("Booting Ariel:")); | |||
Serial.println(F(" -Starting Ariel")); | |||
Serial.println(F(" -Serial port is open @9600.")); | |||
nrf24Initialize(false); // Radio initialisation function | |||
Serial.print(F(" -Attaching Arm Servo:\t")); | |||
servoArm.attach(5); // Attach Arm signal to the pin | |||
if (!servoArm.attached()) | |||
Serial.println(F("servoArm attach failed")); | |||
else | |||
Serial.println(F("OK")); | |||
servoGrab.attach(3); // Attach Grab signal to the pin | |||
Serial.print(F(" -Attaching Grab Servo:\t")); | |||
if (!servoGrab.attached()) | |||
Serial.println(F("servoGrab attach failed")); | |||
else | |||
Serial.println(F("OK")); | |||
sensors.begin(); // Initialise the temperaturesensor bus | |||
Serial.print(F("Gettnig motorShaftTemp address\t")); | |||
if (!sensors.getAddress(motorShaftTemp, 0)) // Check if the temperaturesensors are connected. | |||
Serial.println(F("Unable to find address for motorShaftTemp")); | |||
else | |||
Serial.println(F("OK")); | |||
Serial.print(F(" -Connecting motorShaftTemp:\t")); | |||
if (!sensors.isConnected(motorShaftTemp)) | |||
Serial.println(F("motorShaftTemp is not connected")); | |||
else | |||
Serial.println(F("OK")); | |||
Serial.println(F("Attaching armStepper:\t")); | |||
armStepper.setMaxSpeed(220 * rpm2steps); | |||
Serial.print(F(" -Max speed:\t")); | |||
Serial.println(armStepper.maxSpeed()); | |||
armStepper.setAcceleration(acceleration); | |||
Serial.print(F(" -Acceleration:\t")); | |||
Serial.println(acceleration); | |||
Serial.print(F(" -Position:\t")); | |||
Serial.println(armStepper.currentPosition()); | |||
Serial.println(F("Attaching kopStepper:\t")); | |||
kopStepper.setMaxSpeed(180 * rpm2steps); | |||
Serial.print(F(" -Max speed:\t")); | |||
Serial.println(kopStepper.maxSpeed()); | |||
kopStepper.setAcceleration(acceleration); | |||
Serial.print(F(" -Acceleration:\t")); | |||
Serial.println(acceleration); | |||
Serial.print(F(" -Position:\t")); | |||
Serial.println(kopStepper.currentPosition()); | |||
Serial.println(F("Attaching shaftStepper:\t")); | |||
shaftStepper.setMaxSpeed(220 * rpm2steps); | |||
Serial.print(F(" -Max speed:\t")); | |||
Serial.println(shaftStepper.maxSpeed()); | |||
shaftStepper.setAcceleration(acceleration); | |||
Serial.print(F(" -Acceleration:\t")); | |||
Serial.println(acceleration); | |||
Serial.print(F(" -Position:\t")); | |||
Serial.println(shaftStepper.currentPosition()); | |||
Serial.println(F("- SPI diabled")); | |||
SPI.end(); | |||
Serial.println(F("Ariel has started")); | |||
} | |||
/////////////////////////////// | |||
//////////MAIN LOOP//////////// | |||
////////////////////////////// | |||
#ifdef REMOTE | |||
void loop() { | |||
SPI.begin(); | |||
sensors.requestTemperatures(); // Send the command to get temperatures | |||
Serial.print(F("Temperature for the Steppermotor is: ")); | |||
Serial.println(sensors.getTempC(motorShaftTemp)); | |||
if (nrf24ReceiveMessage(buf, &len)) | |||
{ | |||
Serial.println(F("Message received")); | |||
int c = countCommand(commandos); | |||
for (int n = 0; n < c; n += 1) | |||
{ | |||
commandos[n].command = NULL; | |||
commandos[n].value = NULL; | |||
} | |||
c = buf[0]; | |||
Serial.println("Received " + String(c) + " commands"); | |||
for (int n = 0; n < c; n += 1) | |||
{ | |||
addCommand(commandos, (char)buf[n * 3 + 1], (((int)buf[n * 3 + 2]) << 8) + (int)buf[n * 3 + 3]); | |||
} | |||
//digitalWrite(11, LOW); | |||
//digitalWrite(8, HIGH); | |||
//radioSleep(); | |||
//SPI.transfer(0xAA); | |||
//SPI.setDataMode(SPI_MODE0); | |||
//delay(2000); | |||
SPI.endTransaction(); | |||
SPI.end(); | |||
shaftStepper.disableOutputs(); | |||
Serial.println(digitalRead(9)); | |||
Serial.println(digitalRead(11)); | |||
Serial.println(digitalRead(12)); | |||
Serial.println(digitalRead(12)); | |||
shaftStepper.enableOutputs(); | |||
Serial.println(F("Received commands!")); | |||
Serial.println(); | |||
printCommand(commandos); | |||
Serial.println(F("Waiting 3 seconds before executing")); | |||
delay(3000); | |||
runCommand(commandos); | |||
delay(1000); | |||
Serial.println(); | |||
sensors.requestTemperatures(); // Send the command to get temperatures | |||
Serial.print(F("Temperature for the Steppermotor is: ")); | |||
Serial.println(sensors.getTempC(motorShaftTemp)); | |||
Serial.println("DONE!"); | |||
} | |||
} | |||
#else | |||
void loop() | |||
{ | |||
int c = Serial.read(); | |||
switch (c) | |||
{ | |||
case '-': | |||
{ | |||
remoteStep--; | |||
if (remoteStep == 0) | |||
remoteStep = 1; | |||
Serial.print(F("Stepsize: ")); | |||
Serial.println(remoteStep); | |||
break; | |||
} | |||
case '+': | |||
{ | |||
remoteStep++; | |||
Serial.print(F("Stepsize: ")); | |||
Serial.println(remoteStep); | |||
break; | |||
} | |||
case '(': | |||
{ | |||
kopSpeed -= remoteStep; | |||
if (kopSpeed < 0) | |||
kopSpeed = 0; | |||
Serial.print(F("kopSpeed: ")); | |||
Serial.println(kopSpeed); | |||
break; | |||
} | |||
case ')': | |||
{ | |||
kopSpeed += remoteStep; | |||
if (kopSpeed > kopStepper.maxSpeed()) | |||
kopSpeed = kopStepper.maxSpeed(); | |||
Serial.print(F("kopSpeed: ")); | |||
Serial.println(kopSpeed); | |||
break; | |||
} | |||
case '0': | |||
{ | |||
Serial.println(F("All stop!")); | |||
SPI.end(); | |||
kopStepper.stop(); | |||
while (kopStepper.distanceToGo()) | |||
kopStepper.run(); | |||
kopSpeed = 0; | |||
grabberNeutral(); | |||
armNeutral(); | |||
kopStepper.disableOutputs(); | |||
armStepper.disableOutputs(); | |||
shaftStepper.disableOutputs(); | |||
break; | |||
} | |||
case '4': | |||
{ | |||
grabPos += remoteStep; | |||
grabberTurnPos(grabPos); | |||
break; | |||
} | |||
case '6': | |||
{ | |||
grabPos -= remoteStep; | |||
grabberTurnPos(grabPos); | |||
break; | |||
} | |||
case '8': | |||
{ | |||
debug(F("arm offset: ")); | |||
debug(armOffset); | |||
armPos += remoteStep; | |||
armTurnPos(armPos); | |||
break; | |||
} | |||
case '2': | |||
{ | |||
debug(F("arm offset: ")); | |||
debug(armOffset); | |||
armPos -= remoteStep; | |||
armTurnPos(armPos); | |||
break; | |||
} | |||
case '5': | |||
{ | |||
Serial.println(F("turning one round @60RPM: ")); | |||
kopStepper.setSpeed(60 * rpm2steps); | |||
kopStepper.move(stepsPerRevolution); | |||
kopStepper.runSpeedToPosition(); | |||
break; | |||
} | |||
case 'c': | |||
{ | |||
r_Cut(); | |||
break; | |||
} | |||
case 'r': | |||
{ | |||
r_RPMtester(kopStepper); | |||
break; | |||
} | |||
case 'd': | |||
{ | |||
r_DirectionTest(); | |||
break; | |||
} | |||
case '*': | |||
{ | |||
sensors.requestTemperatures(); // Send the command to get temperatures | |||
Serial.print(F("Temperature for the Steppermotor is: ")); | |||
Serial.println(sensors.getTempC(motorShaftTemp)); | |||
break; | |||
} | |||
case '.': | |||
{ | |||
Serial.println(F("Locking the motor for 1 second")); | |||
kopStepper.setSpeed(0); | |||
kopStepper.move(1); | |||
kopStepper.move(-1); | |||
unsigned long previousMillis = millis(); | |||
while (millis() - previousMillis <= 1000) | |||
kopStepper.runSpeed(); | |||
kopStepper.disableOutputs(); | |||
break; | |||
} | |||
case '/': | |||
{ | |||
Serial.println(F("Swithcing motor direction")); | |||
motorDirection *= -1; | |||
break; | |||
case '[': | |||
{ | |||
Serial.println(F("Reseting arm motor position to 0")); | |||
armStepper.setCurrentPosition(armStepper.currentPosition()); | |||
break; | |||
} | |||
case ']': | |||
{ | |||
Serial.print(F("Current arm motor position: ")); | |||
Serial.println(armStepper.currentPosition()); | |||
break; | |||
} | |||
case '{': | |||
{ | |||
Serial.println(F("Reseting shaft motor position to 0")); | |||
shaftStepper.setCurrentPosition(shaftStepper.currentPosition()); | |||
break; | |||
} | |||
case '}': | |||
{ | |||
Serial.print(F("Current shaft motor position: ")); | |||
Serial.println(shaftStepper.currentPosition()); | |||
break; | |||
} | |||
case '9': | |||
{ | |||
Serial.println(F("Extending shaft")); | |||
shaftStepper.moveTo(900); | |||
shaftStepper.runToPosition(); | |||
shaftStepper.disableOutputs(); | |||
break; | |||
} | |||
case '7': | |||
{ | |||
Serial.println(F("Retracting shaft")); | |||
shaftStepper.moveTo(0); | |||
shaftStepper.runToPosition(); | |||
shaftStepper.disableOutputs(); | |||
break; | |||
} | |||
case '3': | |||
{ | |||
Serial.println(F("Extending arm ")); | |||
armStepper.moveTo(750); | |||
armStepper.runToPosition(); | |||
armStepper.disableOutputs(); | |||
break; | |||
} | |||
case '1': | |||
{ | |||
Serial.println(F("Retracting arm ")); | |||
armStepper.moveTo(0); | |||
armStepper.runToPosition(); | |||
armStepper.disableOutputs(); | |||
break; | |||
} | |||
case 't': | |||
{ | |||
Serial.println("Testing command "); | |||
addCommand(commandos, 't', 1); | |||
addCommand(commandos, 'W', 0); | |||
addCommand(commandos, 'D', 0); | |||
addCommand(commandos, 'c', 0); | |||
addCommand(commandos, 'A', 0); | |||
addCommand(commandos, 'S', 0); | |||
addCommand(commandos, 't', 2); | |||
addCommand(commandos, 'W', 0); | |||
addCommand(commandos, 'D', 0); | |||
addCommand(commandos, 'i', 0); | |||
addCommand(commandos, 'A', 0); | |||
addCommand(commandos, 'S', 0); | |||
addCommand(commandos, 't', 3); | |||
addCommand(commandos, 'W', 0); | |||
addCommand(commandos, 'D', 0); | |||
addCommand(commandos, 'i', 180); | |||
addCommand(commandos, 'A', 0); | |||
addCommand(commandos, 'S', 0); | |||
addCommand(commandos, 't', 0); | |||
delay(1000); | |||
printCommand(commandos); | |||
delay(1000); | |||
runCommand(commandos); | |||
break; | |||
} | |||
case 'g': | |||
{ | |||
Serial.println("Arduin Routine"); | |||
addCommand(commandos, 'i', 180); | |||
addCommand(commandos, 'd', 1000); | |||
addCommand(commandos, 'i', 0); | |||
addCommand(commandos, 'u', 180); | |||
addCommand(commandos, 'd', 1000); | |||
addCommand(commandos, 'u', 90); | |||
addCommand(commandos, 'd', 1000); | |||
addCommand(commandos, 'u', 0); | |||
addCommand(commandos, 'd', 500); | |||
addCommand(commandos, 'i', 180); | |||
addCommand(commandos, 'd', 1000); | |||
addCommand(commandos, 'i', 0); | |||
printCommand(commandos); | |||
delay(1000); | |||
runCommand(commandos); | |||
break; | |||
} | |||
case '<': | |||
{ | |||
Serial.println(F("Spooling up kopStepper")); | |||
kopStepper.move(-2000); | |||
while (kopStepper.distanceToGo() < -1000) | |||
kopStepper.run(); | |||
motorDirection = -1; | |||
kopSpeed = -kopStepper.maxSpeed(); | |||
break; | |||
} | |||
case '>': | |||
{ | |||
Serial.println(F("Spooling up kopStepper")); | |||
kopStepper.move(2000); | |||
while (kopStepper.distanceToGo() > 1000) | |||
kopStepper.run(); | |||
motorDirection = 1; | |||
kopSpeed = kopStepper.maxSpeed(); | |||
break; | |||
} | |||
} | |||
} | |||
// set the motor speed in RPM: | |||
if (kopSpeed) { | |||
kopStepper.setSpeed(motorDirection * kopSpeed * rpm2steps); | |||
kopStepper.runSpeed(); //Run motor at set speed. | |||
} | |||
else | |||
kopStepper.disableOutputs(); | |||
} | |||
#endif // REMOTE | |||
'''Robot.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> | |||
</ItemGroup> | |||
<PropertyGroup Label="Globals"> | |||
<ProjectGuid>{E107B750-A178-4195-BCF5-E1DADA3D52A1}</ProjectGuid> | |||
<RootNamespace>Robot</RootNamespace> | |||
<ProjectName>Robot</ProjectName> | |||
</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> | |||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |||
<ImportGroup Label="ExtensionSettings"> | |||
</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> | |||
<PropertyGroup Label="UserMacros" /> | |||
<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\Robot;C:\Users\s133140\Documents\Arduino\libraries\AccelStepper;C:\Users\s133140\Documents\Arduino\libraries\AccelStepper\utility;C:\Users\s133140\Documents\Arduino\libraries\DallasTemperatureControl;C:\Users\s133140\Documents\Arduino\libraries\DallasTemperatureControl\utility;C:\Users\s133140\Documents\Arduino\libraries\OneWire;C:\Users\s133140\Documents\Arduino\libraries\OneWire\utility;C:\Users\s133140\Documents\Arduino\libraries\RadioHead;C:\Users\s133140\Documents\Arduino\libraries\RadioHead\utility;C:\Users\s133140\Documents\Arduino\libraries\ServoTimer2;C:\Users\s133140\Documents\Arduino\libraries\ServoTimer2\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\Robot\__vm\.Robot.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> | |||
<IgnoreStandardIncludePath>false</IgnoreStandardIncludePath> | |||
<PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_DUEMILANOVE;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
</ClCompile> | |||
<Link> | |||
<GenerateDebugInformation>true</GenerateDebugInformation> | |||
</Link> | |||
</ItemDefinitionGroup> | |||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |||
<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\Robot;C:\Users\Jochem\Documents\Arduino\libraries\AccelStepper;C:\Users\Jochem\Documents\Arduino\libraries\AccelStepper\utility;C:\Users\Jochem\Documents\Arduino\libraries\DallasTemperatureControl;C:\Users\Jochem\Documents\Arduino\libraries\DallasTemperatureControl\utility;C:\Users\Jochem\Documents\Arduino\libraries\OneWire;C:\Users\Jochem\Documents\Arduino\libraries\OneWire\utility;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead\utility;C:\Users\Jochem\Documents\Arduino\libraries\ServoTimer2;C:\Users\Jochem\Documents\Arduino\libraries\ServoTimer2\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\Robot\__vm\.Robot.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> | |||
<WholeProgramOptimization>false</WholeProgramOptimization> | |||
<PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_DUEMILANOVE;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
</ClCompile> | |||
<Link> | |||
<GenerateDebugInformation>true</GenerateDebugInformation> | |||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | |||
<OptimizeReferences>true</OptimizeReferences> | |||
</Link> | |||
</ItemDefinitionGroup> | |||
<ItemGroup> | |||
<None Include="..\Shared\CommandBook.ino" /> | |||
<None Include="..\Shared\nrf24communication.ino" /> | |||
<None Include="functions.ino" /> | |||
<None Include="Robot.ino" /> | |||
<None Include="routine.ino" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClInclude Include="__vm\.Robot.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
upload.tool=avrdude
upload.protocol=arduino
bootloader.tool=avrdude
bootloader.low_fuses=0xFF
bootloader.unlock_bits=0x3F
bootloader.lock_bits=0x0F
build.f_cpu=16000000L
build.board=AVR_DUEMILANOVE
build.core=arduino
build.variant=standard
menu.cpu.atmega328=ATmega328
menu.cpu.atmega328.upload.maximum_size=30720
menu.cpu.atmega328.upload.maximum_data_size=2048
menu.cpu.atmega328.upload.speed=57600
menu.cpu.atmega328.bootloader.high_fuses=0xDA
menu.cpu.atmega328.bootloader.extended_fuses=0x05
menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
menu.cpu.atmega328.build.mcu=atmega328p
menu.cpu.atmega168=ATmega168
menu.cpu.atmega168.upload.maximum_size=14336
menu.cpu.atmega168.upload.maximum_data_size=1024
menu.cpu.atmega168.upload.speed=19200
menu.cpu.atmega168.bootloader.high_fuses=0xdd
menu.cpu.atmega168.bootloader.extended_fuses=0x00
menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
menu.cpu.atmega168.build.mcu=atmega168
runtime.ide.path=C:\Program Files (x86)\Arduino
build.system.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr\system
runtime.ide.version=10609
target_package=arduino
target_platform=avr
runtime.hardware.path=C:\Program Files (x86)\Arduino\hardware\arduino
originalid=diecimila
intellisense.tools.path={runtime.tools.avr-gcc.path}/
intellisense.include.paths={intellisense.tools.path}avr/include/;{intellisense.tools.path}/avr/include/avr/;{intellisense.tools.path}lib\gcc\avr\4.8.1\include
tools.atprogram.cmd.path=%AVRSTUDIO_EXE_PATH%\atbackend\atprogram
tools.atprogram.cmd.setwinpath=true
tools.atprogram.program.params.verbose=-v
tools.atprogram.program.params.quiet=-q
tools.atprogram.program.pattern="{cmd.path}" -d {build.mcu} {program.verbose} {program.extra_params} program -c -f "{build.path}\{build.project_name}.hex"
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"
tools.atprogram.erase.params.verbose=-v
tools.atprogram.erase.params.quiet=-q
tools.atprogram.bootloader.params.verbose=-v
tools.atprogram.bootloader.params.quiet=-q
tools.atprogram.bootloader.pattern="{cmd.path}" -d {build.mcu} {bootloader.verbose} program -c -f "{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}"
version=1.6.11
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2hex.flags=-O ihex -R .eeprom
compiler.elf2hex.cmd=avr-objcopy
compiler.ldflags=
compiler.size.cmd=avr-size
build.extra_flags=
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.S.extra_flags=
compiler.cpp.extra_flags=
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=
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}"
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}"
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}"
archive_file_path={build.path}/{archive_file}
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
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
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"
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"
recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}.{build.variant}.hex
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
preproc.includes.flags=-w -x c++ -M -MG -MP
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}"
preproc.macros.flags=-w -x c++ -E -CC
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}"
tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.cmd.path={path}/bin/avrdude
tools.avrdude.config.path={path}/etc/avrdude.conf
tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.params.quiet=-q -q
tools.avrdude.upload.params.noverify=-V
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"
tools.avrdude.program.params.verbose=-v
tools.avrdude.program.params.quiet=-q -q
tools.avrdude.program.params.noverify=-V
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"
tools.avrdude.erase.params.verbose=-v
tools.avrdude.erase.params.quiet=-q -q
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
tools.avrdude.bootloader.params.verbose=-v
tools.avrdude.bootloader.params.quiet=-q -q
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
tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}
build.usb_manufacturer="Unknown"
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
vm.platform.root.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\arduino16x
avrisp.name=AVR ISP
avrisp.communication=serial
avrisp.protocol=stk500v1
avrisp.program.protocol=stk500v1
avrisp.program.tool=avrdude
avrisp.program.extra_params=-P{serial.port}
avrispmkii.name=AVRISP mkII
avrispmkii.communication=usb
avrispmkii.protocol=stk500v2
avrispmkii.program.protocol=stk500v2
avrispmkii.program.tool=avrdude
avrispmkii.program.extra_params=-Pusb
usbtinyisp.name=USBtinyISP
usbtinyisp.protocol=usbtiny
usbtinyisp.program.tool=avrdude
usbtinyisp.program.extra_params=
arduinoisp.name=ArduinoISP
arduinoisp.protocol=arduinoisp
arduinoisp.program.tool=avrdude
arduinoisp.program.extra_params=
usbasp.name=USBasp
usbasp.communication=usb
usbasp.protocol=usbasp
usbasp.program.protocol=usbasp
usbasp.program.tool=avrdude
usbasp.program.extra_params=-Pusb
parallel.name=Parallel Programmer
parallel.protocol=dapa
parallel.force=true
parallel.program.tool=avrdude
parallel.program.extra_params=-F
arduinoasisp.name=Arduino as ISP
arduinoasisp.communication=serial
arduinoasisp.protocol=stk500v1
arduinoasisp.speed=19200
arduinoasisp.program.protocol=stk500v1
arduinoasisp.program.speed=19200
arduinoasisp.program.tool=avrdude
arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}
usbGemma.name=Arduino Gemma
usbGemma.protocol=arduinogemma
usbGemma.program.tool=avrdude
usbGemma.program.extra_params=
usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf
stk500.name=Atmel STK500 development board
stk500.communication=serial
stk500.protocol=stk500
stk500.program.protocol=stk500
stk500.program.tool=avrdude
stk500.program.extra_params=-P{serial.port}
buspirate.name=BusPirate as ISP
buspirate.communication=serial
buspirate.protocol=buspirate
buspirate.program.protocol=buspirate
buspirate.program.tool=avrdude
buspirate.program.extra_params=-P{serial.port}
runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
runtime.tools.avrdude-6.0.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
runtime.tools.avr-gcc-4.8.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
upload.maximum_size=30720
upload.maximum_data_size=2048
upload.speed=57600
bootloader.high_fuses=0xDA
bootloader.extended_fuses=0x05
bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
build.mcu=atmega328p
runtime.vm.boardinfo.id=diecimila_atmega328
runtime.vm.boardinfo.name=diecimila_atmega328
runtime.vm.boardinfo.desc=Arduino Duemilanove or Diecimila w/ ATmega328
runtime.vm.boardinfo.src_location=C:\Program Files (x86)\Arduino\hardware\arduino\avr
ide.hint=For use with Arduino.cc 1.6.2+ ide
ide.location.key=Arduino16x
ide.location.ide.winreg=Arduino 1.6.x Application
ide.location.sketchbook.winreg=Arduino 1.6.x Sketchbook
ide.location.sketchbook.preferences=sketchbook.path
ide.default.revision_name=1.6.9
ide.default.version=10609
ide.default.package=arduino
ide.default.platform=avr
ide.multiplatform=true
ide.includes=arduino.h
ide.exe_name=arduino
ide.platformswithoutpackage=false
ide.includes.fallback=wprogram.h
ide.extension=ino
ide.extension.fallback=pde
ide.versionGTEQ=160
ide.exe=arduino.exe
ide.hosts=atmel
ide.url=http://arduino.cc/en/Main/Software
ide.help.reference.path=reference\arduino.cc\en\Reference
ide.help.reference.path2=reference\www.arduino.cc\en\Reference
ide.help.reference.serial=reference\www.arduino.cc\en\Serial
vm.debug=true
software=ARDUINO
ssh.user.name=root
ssh.user.default.password=arduino
ssh.host.wwwfiles.path=/www/sd
build.working_directory={runtime.ide.path}
ide.location.preferences.portable={runtime.ide.path}\portable
ide.location.preferences=%VM_APPDATA_LOCAL%\arduino15\preferences.txt
ide.location.preferences_fallback=%VM_APPDATA_ROAMING%\arduino15\preferences.txt
ide.location.contributions=%VM_APPDATA_LOCAL%\arduino15
ide.location.contributions_fallback=%VM_APPDATA_ROAMING%\arduino15
ide.contributions.boards.allow=true
ide.contributions.boards.ignore_unless_rewrite_found=true
ide.contributions.libraries.allow=true
ide.contributions.boards.support.urls.wiki=https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
ide.create_platforms_from_boardsTXT.teensy=build.core
ide.appid=arduino16x
location.sketchbook=C:\Users\s133140\Documents\Arduino
vm.core.include=arduino.h
vm.boardsource.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr
runtime.platform.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr
vm.platformname.name=avr
build.arch=AVR
build.architecture=avr
vmresolved.compiler.path=C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\
vmresolved.tools.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
" 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="COM5" visualmicro.platform.name="avr" arduino.build.core="arduino" /> | |||
</VisualStudio> | |||
</ProjectExtensions> | |||
</Project> | |||
'''Robot.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="functions.ino" /> | |||
<None Include="routine.ino" /> | |||
<None Include="..\Shared\nrf24communication.ino" /> | |||
<None Include="Robot.ino" /> | |||
<None Include="..\Shared\CommandBook.ino" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClInclude Include="__vm\.Robot.vsarduino.h"> | |||
<Filter>Header Files</Filter> | |||
</ClInclude> | |||
</ItemGroup> | |||
</Project> | |||
'''functions.ino''' | |||
//////////////////////////////////////// | |||
//////ARM AND GRABBER FUNCTIONS///////// | |||
//////////////////////////////////////// | |||
void armNeutral() | |||
{ | |||
debugln("Arm to neutral position"); | |||
servoArm.write(armNeutralPosition); //neutral position | |||
armPos = armNeutralPosition; | |||
delay(100); | |||
} | |||
void grabberNeutral() | |||
{ | |||
debugln("Grabber to neutral position"); | |||
servoGrab.write(grabberNeutralPosition); //neutral position | |||
grabPos = grabberNeutralPosition; | |||
delay(200); | |||
} | |||
void grabberGrab() | |||
{ | |||
debugln("Grabbing"); | |||
servoGrab.write(180); | |||
delay(1000); | |||
servoGrab.write(grabberGrabPosition); //Grab (and move up arm?) | |||
delay(1000); | |||
} | |||
void grabberTurnPos(int pos) | |||
{ | |||
debug("Grabber to position "); | |||
debugln(pos); | |||
servoGrab.write(pos); //servo position | |||
delay(100); | |||
} | |||
void armTurnPos(int pos) | |||
{ | |||
debug("Arm to position "); | |||
debugln(pos); | |||
servoArm.write(pos); //servo position | |||
delay(100); | |||
} | |||
void resetServos() | |||
{ | |||
debugln("Resetting servo"); | |||
delay(80); | |||
servoGrab.write(grabPos + 1); | |||
servoArm.write(armPos + 1); | |||
delay(20); | |||
servoGrab.write(grabPos); | |||
servoArm.write(armPos); | |||
} | |||
void leBlink(int ledPin, int n) | |||
{ | |||
for (int i = 0; i < n; i++) | |||
{ | |||
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level) | |||
delay(100); // wait for a second | |||
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW | |||
delay(100); // wait for a second | |||
} | |||
} | |||
/*not used | |||
void setTemperatureAlarm(int temp) | |||
{ | |||
sensors.setLowAlarmTemp(motorShaftTemp, -10); | |||
sensors.setHighAlarmTemp(motorShaftTemp, temp); | |||
} | |||
void checkAlarm() | |||
{ | |||
if (sensors.hasAlarm()) | |||
{ | |||
Serial.println("ALARM ON MOTOR 1"); | |||
} | |||
}*/ | |||
'''routine.ino''' | |||
void r_Cut() | |||
{ | |||
grabberGrab(); | |||
for (int i = 0; i < 20; i++) | |||
{ | |||
armTurnPos(armPos + 45); | |||
delay(200); | |||
armTurnPos(armPos - 45); | |||
delay(200); | |||
} | |||
delay(500); | |||
grabberNeutral(); | |||
armTurnPos(armPos); | |||
} | |||
void r_Grab() | |||
{ | |||
grabberGrab(); | |||
grabberNeutral(); | |||
armTurnPos(armPos); | |||
} | |||
void r_RPMtester(AccelStepper driver) | |||
{ | |||
Serial.println(F("Testing RPM:")); | |||
Serial.print(F(" -Max speed: ")); | |||
Serial.println(driver.maxSpeed()); | |||
for (int i = 100; i < 500; i += 50) | |||
{ | |||
Serial.print(F(" -Acceleration: ")); | |||
Serial.println(i); | |||
driver.setAcceleration(i); | |||
driver.move(500 * stepsPerRevolution); | |||
while (driver.distanceToGo()) | |||
driver.run(); | |||
Serial.println(F("Starting next iteration in 1 second")); | |||
delay(1000); | |||
} | |||
Serial.println(F("Nope....Test is over. Resuming in 3 seconds")); | |||
delay(3000); | |||
} | |||
void r_DirectionTest() | |||
{ | |||
Serial.println(F("Testing Drirectoion:")); | |||
Serial.println(F("------------------")); | |||
Serial.println(F("Arm motor +")); | |||
armStepper.move(50); | |||
armStepper.runToPosition(); | |||
armStepper.move(-50); | |||
armStepper.runToPosition(); | |||
armStepper.disableOutputs(); | |||
Serial.println(F("Shaft motor +")); | |||
shaftStepper.move(50); | |||
shaftStepper.runToPosition(); | |||
shaftStepper.move(-50); | |||
shaftStepper.runToPosition(); | |||
shaftStepper.disableOutputs(); | |||
Serial.println(F("Kop motor +")); | |||
kopStepper.move(50); | |||
kopStepper.runToPosition(); | |||
kopStepper.move(-50); | |||
kopStepper.runToPosition(); | |||
kopStepper.disableOutputs(); | |||
} | |||
void r_MovePlant(int plant) | |||
{ | |||
kopStepper.moveTo((int)200*plant); | |||
kopStepper.runToPosition(); | |||
} | |||
====Shared==== | |||
'''CommandBook.ino''' | '''CommandBook.ino''' | ||
Line 986: | Line 1,851: | ||
return false; | return false; | ||
} | } | ||
Latest revision as of 16:24, 20 June 2016
Repository: https://github.com/Petzep/UseWaterpret
Repository
Library
Libraries used:
- Arduino_Menu
- DallasTemperatureControl
- OneWire
- RadioHead-1.59
- ServoTimer2
Solution
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
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
 upload.tool=avrdude
 upload.protocol=arduino
 bootloader.tool=avrdude
 bootloader.low_fuses=0xFF
 bootloader.unlock_bits=0x3F
 bootloader.lock_bits=0x0F
 build.f_cpu=16000000L
 build.board=AVR_DUEMILANOVE
 build.core=arduino
 build.variant=standard
 menu.cpu.atmega328=ATmega328
 menu.cpu.atmega328.upload.maximum_size=30720
 menu.cpu.atmega328.upload.maximum_data_size=2048
 menu.cpu.atmega328.upload.speed=57600
 menu.cpu.atmega328.bootloader.high_fuses=0xDA
 menu.cpu.atmega328.bootloader.extended_fuses=0x05
 menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
 menu.cpu.atmega328.build.mcu=atmega328p
 menu.cpu.atmega168=ATmega168
 menu.cpu.atmega168.upload.maximum_size=14336
 menu.cpu.atmega168.upload.maximum_data_size=1024
 menu.cpu.atmega168.upload.speed=19200
 menu.cpu.atmega168.bootloader.high_fuses=0xdd
 menu.cpu.atmega168.bootloader.extended_fuses=0x00
 menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
 menu.cpu.atmega168.build.mcu=atmega168
 runtime.ide.path=C:\Program Files (x86)\Arduino
 build.system.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr\system
 runtime.ide.version=10609
 target_package=arduino
 target_platform=avr
 runtime.hardware.path=C:\Program Files (x86)\Arduino\hardware\arduino
 originalid=diecimila
 intellisense.tools.path={runtime.tools.avr-gcc.path}/
 intellisense.include.paths={intellisense.tools.path}avr/include/;{intellisense.tools.path}/avr/include/avr/;{intellisense.tools.path}lib\gcc\avr\4.8.1\include
 tools.atprogram.cmd.path=%AVRSTUDIO_EXE_PATH%\atbackend\atprogram
 tools.atprogram.cmd.setwinpath=true
 tools.atprogram.program.params.verbose=-v
 tools.atprogram.program.params.quiet=-q
 tools.atprogram.program.pattern="{cmd.path}" -d {build.mcu} {program.verbose} {program.extra_params} program -c -f "{build.path}\{build.project_name}.hex"
 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"
 tools.atprogram.erase.params.verbose=-v
 tools.atprogram.erase.params.quiet=-q
 tools.atprogram.bootloader.params.verbose=-v
 tools.atprogram.bootloader.params.quiet=-q
 tools.atprogram.bootloader.pattern="{cmd.path}" -d {build.mcu} {bootloader.verbose} program -c -f "{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}"
 version=1.6.11
 compiler.warning_flags=-w
 compiler.warning_flags.none=-w
 compiler.warning_flags.default=
 compiler.warning_flags.more=-Wall
 compiler.warning_flags.all=-Wall -Wextra
 compiler.path={runtime.tools.avr-gcc.path}/bin/
 compiler.c.cmd=avr-gcc
 compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD
 compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
 compiler.c.elf.cmd=avr-gcc
 compiler.S.flags=-c -g -x assembler-with-cpp
 compiler.cpp.cmd=avr-g++
 compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
 compiler.ar.cmd=avr-ar
 compiler.ar.flags=rcs
 compiler.objcopy.cmd=avr-objcopy
 compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
 compiler.elf2hex.flags=-O ihex -R .eeprom
 compiler.elf2hex.cmd=avr-objcopy
 compiler.ldflags=
 compiler.size.cmd=avr-size
 build.extra_flags=
 compiler.c.extra_flags=
 compiler.c.elf.extra_flags=
 compiler.S.extra_flags=
 compiler.cpp.extra_flags=
 compiler.ar.extra_flags=
 compiler.objcopy.eep.extra_flags=
 compiler.elf2hex.extra_flags=
 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}"
 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}"
 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}"
 archive_file_path={build.path}/{archive_file}
 recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
 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
 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"
 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"
 recipe.output.tmp_file={build.project_name}.hex
 recipe.output.save_file={build.project_name}.{build.variant}.hex
 recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
 recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
 recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
 recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
 preproc.includes.flags=-w -x c++ -M -MG -MP
 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}"
 preproc.macros.flags=-w -x c++ -E -CC
 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}"
 tools.avrdude.path={runtime.tools.avrdude.path}
 tools.avrdude.cmd.path={path}/bin/avrdude
 tools.avrdude.config.path={path}/etc/avrdude.conf
 tools.avrdude.upload.params.verbose=-v
 tools.avrdude.upload.params.quiet=-q -q
 tools.avrdude.upload.params.noverify=-V
 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"
 tools.avrdude.program.params.verbose=-v
 tools.avrdude.program.params.quiet=-q -q
 tools.avrdude.program.params.noverify=-V
 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"
 tools.avrdude.erase.params.verbose=-v
 tools.avrdude.erase.params.quiet=-q -q
 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
 tools.avrdude.bootloader.params.verbose=-v
 tools.avrdude.bootloader.params.quiet=-q -q
 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
 tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}
 build.usb_manufacturer="Unknown"
 build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
 vm.platform.root.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\arduino16x
 avrisp.name=AVR ISP
 avrisp.communication=serial
 avrisp.protocol=stk500v1
 avrisp.program.protocol=stk500v1
 avrisp.program.tool=avrdude
 avrisp.program.extra_params=-P{serial.port}
 avrispmkii.name=AVRISP mkII
 avrispmkii.communication=usb
 avrispmkii.protocol=stk500v2
 avrispmkii.program.protocol=stk500v2
 avrispmkii.program.tool=avrdude
 avrispmkii.program.extra_params=-Pusb
 usbtinyisp.name=USBtinyISP
 usbtinyisp.protocol=usbtiny
 usbtinyisp.program.tool=avrdude
 usbtinyisp.program.extra_params=
 arduinoisp.name=ArduinoISP
 arduinoisp.protocol=arduinoisp
 arduinoisp.program.tool=avrdude
 arduinoisp.program.extra_params=
 usbasp.name=USBasp
 usbasp.communication=usb
 usbasp.protocol=usbasp
 usbasp.program.protocol=usbasp
 usbasp.program.tool=avrdude
 usbasp.program.extra_params=-Pusb
 parallel.name=Parallel Programmer
 parallel.protocol=dapa
 parallel.force=true
 parallel.program.tool=avrdude
 parallel.program.extra_params=-F
 arduinoasisp.name=Arduino as ISP
 arduinoasisp.communication=serial
 arduinoasisp.protocol=stk500v1
 arduinoasisp.speed=19200
 arduinoasisp.program.protocol=stk500v1
 arduinoasisp.program.speed=19200
 arduinoasisp.program.tool=avrdude
 arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}
 usbGemma.name=Arduino Gemma
 usbGemma.protocol=arduinogemma
 usbGemma.program.tool=avrdude
 usbGemma.program.extra_params=
 usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf
 stk500.name=Atmel STK500 development board
 stk500.communication=serial
 stk500.protocol=stk500
 stk500.program.protocol=stk500
 stk500.program.tool=avrdude
 stk500.program.extra_params=-P{serial.port}
 buspirate.name=BusPirate as ISP
 buspirate.communication=serial
 buspirate.protocol=buspirate
 buspirate.program.protocol=buspirate
 buspirate.program.tool=avrdude
 buspirate.program.extra_params=-P{serial.port}
 runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 runtime.tools.avrdude-6.0.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 runtime.tools.avr-gcc-4.8.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 upload.maximum_size=30720
 upload.maximum_data_size=2048
 upload.speed=57600
 bootloader.high_fuses=0xDA
 bootloader.extended_fuses=0x05
 bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
 build.mcu=atmega328p
 runtime.vm.boardinfo.id=diecimila_atmega328
 runtime.vm.boardinfo.name=diecimila_atmega328
 runtime.vm.boardinfo.desc=Arduino Duemilanove or Diecimila w/ ATmega328
 runtime.vm.boardinfo.src_location=C:\Program Files (x86)\Arduino\hardware\arduino\avr
 ide.hint=For use with Arduino.cc 1.6.2+ ide
 ide.location.key=Arduino16x
 ide.location.ide.winreg=Arduino 1.6.x Application
 ide.location.sketchbook.winreg=Arduino 1.6.x Sketchbook
 ide.location.sketchbook.preferences=sketchbook.path
 ide.default.revision_name=1.6.9
 ide.default.version=10609
 ide.default.package=arduino
 ide.default.platform=avr
 ide.multiplatform=true
 ide.includes=arduino.h
 ide.exe_name=arduino
 ide.platformswithoutpackage=false
 ide.includes.fallback=wprogram.h
 ide.extension=ino
 ide.extension.fallback=pde
 ide.versionGTEQ=160
 ide.exe=arduino.exe
 ide.hosts=atmel
 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
 runtime.platform.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr
 vm.platformname.name=avr
 build.arch=AVR
 build.architecture=avr
 vmresolved.compiler.path=C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\
 vmresolved.tools.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 " 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
CommandBook.ino
int countCommand(CommandBook *book) { int c = 0; while (book[c].command != NULL && c < BOOKSIZE) c++; return c; } void addCommand(CommandBook *book, char command, int value) { int c = countCommand(book); book[c].command = command; book[c].value = value; } void runCommand(CommandBook *book) { int c = countCommand(book); for (int i = 0; i < c; i++) { switch (book[i].command) { case 'm': { myStepper.move(book[i].value); while (myStepper.distanceToGo()) myStepper.run(); myStepper.disableOutputs(); break; } case 'd': { delay(book[i].value); break; } default: { Serial.println("Invaild command!"); break; } } book[i].command = NULL; book[i].value = NULL; } } void printCommand(CommandBook *book) { int c = countCommand(book); Serial.println("Commandos in book:"); for (int i = 0; i < c; i++) { Serial.print('-'); Serial.print(book[i].command); Serial.print('\t'); Serial.println(book[i].value); } Serial.println("Done"); }
Robot.ino
/* Name: Robot.ino Created: 5/19/2016 4:07:57 PM Author: Use Waterpret */ #define Servo ServoTimer2 //#define ENABLE_DEBUG //#define REMOTE #define BOOKSIZE 20 struct CommandBook { char command; int value; }; #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 #include <Arduino.h> // Fixes some define problems #include <ServoTimer2.h> // Include servo library #include <AccelStepper.h> // AccelStepper library for precise and fluid steppercontrol #include <SPI.h> // The SPI-communication liberary for the antenna #include <OneWire\OneWire.h> // The OneWire-protocol used by te temp sensor #include <DallasTemperatureControl\DallasTemperature.h> // DallasTemperature library for controlling the DS18S20 temperature monitor OneWire oneWire(A0); // Setup a oneWire instance to communicate with any OneWire devices DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. AccelStepper shaftStepper(AccelStepper::FULL4WIRE, 13, 12, 11, 9, TRUE);// initialize the stepper library on pins 13,12,11,9 and disable the output; AccelStepper kopStepper(AccelStepper::FULL4WIRE, 2, 4, 6, 7, FALSE); // initialize the stepper library on pins 2,4,6,7 and disable the output; AccelStepper armStepper(AccelStepper::FULL4WIRE, A2, A3, A4, A5, FALSE);// initialize the stepper library on pins A2,A3,A4,A5 and disable the output; CommandBook commandos[BOOKSIZE] = {}; // array with commands for the Arduino DeviceAddress motorShaftTemp; // arrays to hold device addresses of the TempSensors Servo servoArm; // Arm servo signal Servo servoGrab; // Grabbbing Servo const int delayRest = 100; // Standard delay for momentum to stablelize const int armNeutralPosition = 90; // Neutral position of the grabber const int grabberNeutralPosition = 60; // Ground position of the grabber const int grabberGrabPosition = 0; // Position for closed grabbers const int armOffset = 0; // turn ofset for the head in degrees const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution for your motor const int acceleration = 350; // Acceleration const float pi = 3.141592654; // this one is a piece of cake int kopSpeed = 0; // Speed of the kopmotor in RPM char motorDirection = 1; // direction of the motor unsigned long previousMillis = 0; // will store last time LED was updatedvccv float rpm2steps = stepsPerRevolution / 60.0f; uint8_t* buf = new uint8_t[32]; uint8_t len = 32; void r_RPMtester(AccelStepper driver); // Small acceleration test. void r_DirectionTest(); // Small direction test. 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); ///////////////////////////////// ///USER DETERMINED VARIABLES///// ///////////////////////////////// int armPos = armNeutralPosition; int grabPos = grabberNeutralPosition; int remoteStep = 5; void setup() // Built in initialization block { Serial.begin(9600); // open the serial port at 9600 bps: Serial.println(F("Booting Ariel:")); Serial.println(F(" -Starting Ariel")); Serial.println(F(" -Serial port is open @9600.")); nrf24Initialize(false); // Radio initialisation function Serial.print(F(" -Attaching Arm Servo:\t")); servoArm.attach(5); // Attach Arm signal to the pin if (!servoArm.attached()) Serial.println(F("servoArm attach failed")); else Serial.println(F("OK")); servoGrab.attach(3); // Attach Grab signal to the pin Serial.print(F(" -Attaching Grab Servo:\t")); if (!servoGrab.attached()) Serial.println(F("servoGrab attach failed")); else Serial.println(F("OK")); sensors.begin(); // Initialise the temperaturesensor bus Serial.print(F("Gettnig motorShaftTemp address\t")); if (!sensors.getAddress(motorShaftTemp, 0)) // Check if the temperaturesensors are connected. Serial.println(F("Unable to find address for motorShaftTemp")); else Serial.println(F("OK")); Serial.print(F(" -Connecting motorShaftTemp:\t")); if (!sensors.isConnected(motorShaftTemp)) Serial.println(F("motorShaftTemp is not connected")); else Serial.println(F("OK")); Serial.println(F("Attaching armStepper:\t")); armStepper.setMaxSpeed(220 * rpm2steps); Serial.print(F(" -Max speed:\t")); Serial.println(armStepper.maxSpeed()); armStepper.setAcceleration(acceleration); Serial.print(F(" -Acceleration:\t")); Serial.println(acceleration); Serial.print(F(" -Position:\t")); Serial.println(armStepper.currentPosition()); Serial.println(F("Attaching kopStepper:\t")); kopStepper.setMaxSpeed(180 * rpm2steps); Serial.print(F(" -Max speed:\t")); Serial.println(kopStepper.maxSpeed()); kopStepper.setAcceleration(acceleration); Serial.print(F(" -Acceleration:\t")); Serial.println(acceleration); Serial.print(F(" -Position:\t")); Serial.println(kopStepper.currentPosition()); Serial.println(F("Attaching shaftStepper:\t")); shaftStepper.setMaxSpeed(220 * rpm2steps); Serial.print(F(" -Max speed:\t")); Serial.println(shaftStepper.maxSpeed()); shaftStepper.setAcceleration(acceleration); Serial.print(F(" -Acceleration:\t")); Serial.println(acceleration); Serial.print(F(" -Position:\t")); Serial.println(shaftStepper.currentPosition()); Serial.println(F("- SPI diabled")); SPI.end(); Serial.println(F("Ariel has started")); } /////////////////////////////// //////////MAIN LOOP//////////// ////////////////////////////// #ifdef REMOTE void loop() { SPI.begin(); sensors.requestTemperatures(); // Send the command to get temperatures Serial.print(F("Temperature for the Steppermotor is: ")); Serial.println(sensors.getTempC(motorShaftTemp)); if (nrf24ReceiveMessage(buf, &len)) { Serial.println(F("Message received")); int c = countCommand(commandos); for (int n = 0; n < c; n += 1) { commandos[n].command = NULL; commandos[n].value = NULL; } c = buf[0]; Serial.println("Received " + String(c) + " commands"); for (int n = 0; n < c; n += 1) { addCommand(commandos, (char)buf[n * 3 + 1], (((int)buf[n * 3 + 2]) << 8) + (int)buf[n * 3 + 3]); } //digitalWrite(11, LOW); //digitalWrite(8, HIGH); //radioSleep(); //SPI.transfer(0xAA); //SPI.setDataMode(SPI_MODE0); //delay(2000); SPI.endTransaction(); SPI.end(); shaftStepper.disableOutputs(); Serial.println(digitalRead(9)); Serial.println(digitalRead(11)); Serial.println(digitalRead(12)); Serial.println(digitalRead(12)); shaftStepper.enableOutputs(); Serial.println(F("Received commands!")); Serial.println(); printCommand(commandos); Serial.println(F("Waiting 3 seconds before executing")); delay(3000); runCommand(commandos); delay(1000); Serial.println(); sensors.requestTemperatures(); // Send the command to get temperatures Serial.print(F("Temperature for the Steppermotor is: ")); Serial.println(sensors.getTempC(motorShaftTemp)); Serial.println("DONE!"); } } #else void loop() { int c = Serial.read(); switch (c) { case '-': { remoteStep--; if (remoteStep == 0) remoteStep = 1; Serial.print(F("Stepsize: ")); Serial.println(remoteStep); break; } case '+': { remoteStep++; Serial.print(F("Stepsize: ")); Serial.println(remoteStep); break; } case '(': { kopSpeed -= remoteStep; if (kopSpeed < 0) kopSpeed = 0; Serial.print(F("kopSpeed: ")); Serial.println(kopSpeed); break; } case ')': { kopSpeed += remoteStep; if (kopSpeed > kopStepper.maxSpeed()) kopSpeed = kopStepper.maxSpeed(); Serial.print(F("kopSpeed: ")); Serial.println(kopSpeed); break; } case '0': { Serial.println(F("All stop!")); SPI.end(); kopStepper.stop(); while (kopStepper.distanceToGo()) kopStepper.run(); kopSpeed = 0; grabberNeutral(); armNeutral(); kopStepper.disableOutputs(); armStepper.disableOutputs(); shaftStepper.disableOutputs(); break; } case '4': { grabPos += remoteStep; grabberTurnPos(grabPos); break; } case '6': { grabPos -= remoteStep; grabberTurnPos(grabPos); break; } case '8': { debug(F("arm offset: ")); debug(armOffset); armPos += remoteStep; armTurnPos(armPos); break; } case '2': { debug(F("arm offset: ")); debug(armOffset); armPos -= remoteStep; armTurnPos(armPos); break; } case '5': { Serial.println(F("turning one round @60RPM: ")); kopStepper.setSpeed(60 * rpm2steps); kopStepper.move(stepsPerRevolution); kopStepper.runSpeedToPosition(); break; } case 'c': { r_Cut(); break; } case 'r': { r_RPMtester(kopStepper); break; } case 'd': { r_DirectionTest(); break; } case '*': { sensors.requestTemperatures(); // Send the command to get temperatures Serial.print(F("Temperature for the Steppermotor is: ")); Serial.println(sensors.getTempC(motorShaftTemp)); break; } case '.': { Serial.println(F("Locking the motor for 1 second")); kopStepper.setSpeed(0); kopStepper.move(1); kopStepper.move(-1); unsigned long previousMillis = millis(); while (millis() - previousMillis <= 1000) kopStepper.runSpeed(); kopStepper.disableOutputs(); break; } case '/': { Serial.println(F("Swithcing motor direction")); motorDirection *= -1; break; case '[': { Serial.println(F("Reseting arm motor position to 0")); armStepper.setCurrentPosition(armStepper.currentPosition()); break; } case ']': { Serial.print(F("Current arm motor position: ")); Serial.println(armStepper.currentPosition()); break; } case '{': { Serial.println(F("Reseting shaft motor position to 0")); shaftStepper.setCurrentPosition(shaftStepper.currentPosition()); break; } case '}': { Serial.print(F("Current shaft motor position: ")); Serial.println(shaftStepper.currentPosition()); break; } case '9': { Serial.println(F("Extending shaft")); shaftStepper.moveTo(900); shaftStepper.runToPosition(); shaftStepper.disableOutputs(); break; } case '7': { Serial.println(F("Retracting shaft")); shaftStepper.moveTo(0); shaftStepper.runToPosition(); shaftStepper.disableOutputs(); break; } case '3': { Serial.println(F("Extending arm ")); armStepper.moveTo(750); armStepper.runToPosition(); armStepper.disableOutputs(); break; } case '1': { Serial.println(F("Retracting arm ")); armStepper.moveTo(0); armStepper.runToPosition(); armStepper.disableOutputs(); break; } case 't': { Serial.println("Testing command "); addCommand(commandos, 't', 1); addCommand(commandos, 'W', 0); addCommand(commandos, 'D', 0); addCommand(commandos, 'c', 0); addCommand(commandos, 'A', 0); addCommand(commandos, 'S', 0); addCommand(commandos, 't', 2); addCommand(commandos, 'W', 0); addCommand(commandos, 'D', 0); addCommand(commandos, 'i', 0); addCommand(commandos, 'A', 0); addCommand(commandos, 'S', 0); addCommand(commandos, 't', 3); addCommand(commandos, 'W', 0); addCommand(commandos, 'D', 0); addCommand(commandos, 'i', 180); addCommand(commandos, 'A', 0); addCommand(commandos, 'S', 0); addCommand(commandos, 't', 0); delay(1000); printCommand(commandos); delay(1000); runCommand(commandos); break; } case 'g': { Serial.println("Arduin Routine"); addCommand(commandos, 'i', 180); addCommand(commandos, 'd', 1000); addCommand(commandos, 'i', 0); addCommand(commandos, 'u', 180); addCommand(commandos, 'd', 1000); addCommand(commandos, 'u', 90); addCommand(commandos, 'd', 1000); addCommand(commandos, 'u', 0); addCommand(commandos, 'd', 500); addCommand(commandos, 'i', 180); addCommand(commandos, 'd', 1000); addCommand(commandos, 'i', 0); printCommand(commandos); delay(1000); runCommand(commandos); break; } case '<': { Serial.println(F("Spooling up kopStepper")); kopStepper.move(-2000); while (kopStepper.distanceToGo() < -1000) kopStepper.run(); motorDirection = -1; kopSpeed = -kopStepper.maxSpeed(); break; } case '>': { Serial.println(F("Spooling up kopStepper")); kopStepper.move(2000); while (kopStepper.distanceToGo() > 1000) kopStepper.run(); motorDirection = 1; kopSpeed = kopStepper.maxSpeed(); break; } } } // set the motor speed in RPM: if (kopSpeed) { kopStepper.setSpeed(motorDirection * kopSpeed * rpm2steps); kopStepper.runSpeed(); //Run motor at set speed. } else kopStepper.disableOutputs(); } #endif // REMOTE
Robot.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> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E107B750-A178-4195-BCF5-E1DADA3D52A1}</ProjectGuid> <RootNamespace>Robot</RootNamespace> <ProjectName>Robot</ProjectName> </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> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </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> <PropertyGroup Label="UserMacros" /> <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\Robot;C:\Users\s133140\Documents\Arduino\libraries\AccelStepper;C:\Users\s133140\Documents\Arduino\libraries\AccelStepper\utility;C:\Users\s133140\Documents\Arduino\libraries\DallasTemperatureControl;C:\Users\s133140\Documents\Arduino\libraries\DallasTemperatureControl\utility;C:\Users\s133140\Documents\Arduino\libraries\OneWire;C:\Users\s133140\Documents\Arduino\libraries\OneWire\utility;C:\Users\s133140\Documents\Arduino\libraries\RadioHead;C:\Users\s133140\Documents\Arduino\libraries\RadioHead\utility;C:\Users\s133140\Documents\Arduino\libraries\ServoTimer2;C:\Users\s133140\Documents\Arduino\libraries\ServoTimer2\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\Robot\__vm\.Robot.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> <IgnoreStandardIncludePath>false</IgnoreStandardIncludePath> <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;_VMDEBUG=1;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_DUEMILANOVE;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <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\Robot;C:\Users\Jochem\Documents\Arduino\libraries\AccelStepper;C:\Users\Jochem\Documents\Arduino\libraries\AccelStepper\utility;C:\Users\Jochem\Documents\Arduino\libraries\DallasTemperatureControl;C:\Users\Jochem\Documents\Arduino\libraries\DallasTemperatureControl\utility;C:\Users\Jochem\Documents\Arduino\libraries\OneWire;C:\Users\Jochem\Documents\Arduino\libraries\OneWire\utility;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead;C:\Users\Jochem\Documents\Arduino\libraries\RadioHead\utility;C:\Users\Jochem\Documents\Arduino\libraries\ServoTimer2;C:\Users\Jochem\Documents\Arduino\libraries\ServoTimer2\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\Robot\__vm\.Robot.vsarduino.h;%(ForcedIncludeFiles)</ForcedIncludeFiles> <WholeProgramOptimization>false</WholeProgramOptimization> <PreprocessorDefinitions>__AVR_ATmega328p__;__AVR_ATmega328P__;F_CPU=16000000L;ARDUINO=10609;ARDUINO_AVR_DUEMILANOVE;ARDUINO_ARCH_AVR;__cplusplus=201103L;%(PreprocessorDefinitions)</PreprocessorDefinitions> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemGroup> <None Include="..\Shared\CommandBook.ino" /> <None Include="..\Shared\nrf24communication.ino" /> <None Include="functions.ino" /> <None Include="Robot.ino" /> <None Include="routine.ino" /> </ItemGroup> <ItemGroup> <ClInclude Include="__vm\.Robot.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
 upload.tool=avrdude
 upload.protocol=arduino
 bootloader.tool=avrdude
 bootloader.low_fuses=0xFF
 bootloader.unlock_bits=0x3F
 bootloader.lock_bits=0x0F
 build.f_cpu=16000000L
 build.board=AVR_DUEMILANOVE
 build.core=arduino
 build.variant=standard
 menu.cpu.atmega328=ATmega328
 menu.cpu.atmega328.upload.maximum_size=30720
 menu.cpu.atmega328.upload.maximum_data_size=2048
 menu.cpu.atmega328.upload.speed=57600
 menu.cpu.atmega328.bootloader.high_fuses=0xDA
 menu.cpu.atmega328.bootloader.extended_fuses=0x05
 menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
 menu.cpu.atmega328.build.mcu=atmega328p
 menu.cpu.atmega168=ATmega168
 menu.cpu.atmega168.upload.maximum_size=14336
 menu.cpu.atmega168.upload.maximum_data_size=1024
 menu.cpu.atmega168.upload.speed=19200
 menu.cpu.atmega168.bootloader.high_fuses=0xdd
 menu.cpu.atmega168.bootloader.extended_fuses=0x00
 menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
 menu.cpu.atmega168.build.mcu=atmega168
 runtime.ide.path=C:\Program Files (x86)\Arduino
 build.system.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr\system
 runtime.ide.version=10609
 target_package=arduino
 target_platform=avr
 runtime.hardware.path=C:\Program Files (x86)\Arduino\hardware\arduino
 originalid=diecimila
 intellisense.tools.path={runtime.tools.avr-gcc.path}/
 intellisense.include.paths={intellisense.tools.path}avr/include/;{intellisense.tools.path}/avr/include/avr/;{intellisense.tools.path}lib\gcc\avr\4.8.1\include
 tools.atprogram.cmd.path=%AVRSTUDIO_EXE_PATH%\atbackend\atprogram
 tools.atprogram.cmd.setwinpath=true
 tools.atprogram.program.params.verbose=-v
 tools.atprogram.program.params.quiet=-q
 tools.atprogram.program.pattern="{cmd.path}" -d {build.mcu} {program.verbose} {program.extra_params} program -c -f "{build.path}\{build.project_name}.hex"
 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"
 tools.atprogram.erase.params.verbose=-v
 tools.atprogram.erase.params.quiet=-q
 tools.atprogram.bootloader.params.verbose=-v
 tools.atprogram.bootloader.params.quiet=-q
 tools.atprogram.bootloader.pattern="{cmd.path}" -d {build.mcu} {bootloader.verbose} program -c -f "{runtime.ide.path}/hardware/arduino/avr/bootloaders/{bootloader.file}"
 version=1.6.11
 compiler.warning_flags=-w
 compiler.warning_flags.none=-w
 compiler.warning_flags.default=
 compiler.warning_flags.more=-Wall
 compiler.warning_flags.all=-Wall -Wextra
 compiler.path={runtime.tools.avr-gcc.path}/bin/
 compiler.c.cmd=avr-gcc
 compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD
 compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
 compiler.c.elf.cmd=avr-gcc
 compiler.S.flags=-c -g -x assembler-with-cpp
 compiler.cpp.cmd=avr-g++
 compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
 compiler.ar.cmd=avr-ar
 compiler.ar.flags=rcs
 compiler.objcopy.cmd=avr-objcopy
 compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
 compiler.elf2hex.flags=-O ihex -R .eeprom
 compiler.elf2hex.cmd=avr-objcopy
 compiler.ldflags=
 compiler.size.cmd=avr-size
 build.extra_flags=
 compiler.c.extra_flags=
 compiler.c.elf.extra_flags=
 compiler.S.extra_flags=
 compiler.cpp.extra_flags=
 compiler.ar.extra_flags=
 compiler.objcopy.eep.extra_flags=
 compiler.elf2hex.extra_flags=
 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}"
 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}"
 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}"
 archive_file_path={build.path}/{archive_file}
 recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
 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
 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"
 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"
 recipe.output.tmp_file={build.project_name}.hex
 recipe.output.save_file={build.project_name}.{build.variant}.hex
 recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
 recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
 recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
 recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
 preproc.includes.flags=-w -x c++ -M -MG -MP
 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}"
 preproc.macros.flags=-w -x c++ -E -CC
 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}"
 tools.avrdude.path={runtime.tools.avrdude.path}
 tools.avrdude.cmd.path={path}/bin/avrdude
 tools.avrdude.config.path={path}/etc/avrdude.conf
 tools.avrdude.upload.params.verbose=-v
 tools.avrdude.upload.params.quiet=-q -q
 tools.avrdude.upload.params.noverify=-V
 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"
 tools.avrdude.program.params.verbose=-v
 tools.avrdude.program.params.quiet=-q -q
 tools.avrdude.program.params.noverify=-V
 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"
 tools.avrdude.erase.params.verbose=-v
 tools.avrdude.erase.params.quiet=-q -q
 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
 tools.avrdude.bootloader.params.verbose=-v
 tools.avrdude.bootloader.params.quiet=-q -q
 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
 tools.avrdude_remote.upload.pattern=/usr/bin/run-avrdude /tmp/sketch.hex {upload.verbose} -p{build.mcu}
 build.usb_manufacturer="Unknown"
 build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
 vm.platform.root.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\nctamhse.x5i\Micro Platforms\arduino16x
 avrisp.name=AVR ISP
 avrisp.communication=serial
 avrisp.protocol=stk500v1
 avrisp.program.protocol=stk500v1
 avrisp.program.tool=avrdude
 avrisp.program.extra_params=-P{serial.port}
 avrispmkii.name=AVRISP mkII
 avrispmkii.communication=usb
 avrispmkii.protocol=stk500v2
 avrispmkii.program.protocol=stk500v2
 avrispmkii.program.tool=avrdude
 avrispmkii.program.extra_params=-Pusb
 usbtinyisp.name=USBtinyISP
 usbtinyisp.protocol=usbtiny
 usbtinyisp.program.tool=avrdude
 usbtinyisp.program.extra_params=
 arduinoisp.name=ArduinoISP
 arduinoisp.protocol=arduinoisp
 arduinoisp.program.tool=avrdude
 arduinoisp.program.extra_params=
 usbasp.name=USBasp
 usbasp.communication=usb
 usbasp.protocol=usbasp
 usbasp.program.protocol=usbasp
 usbasp.program.tool=avrdude
 usbasp.program.extra_params=-Pusb
 parallel.name=Parallel Programmer
 parallel.protocol=dapa
 parallel.force=true
 parallel.program.tool=avrdude
 parallel.program.extra_params=-F
 arduinoasisp.name=Arduino as ISP
 arduinoasisp.communication=serial
 arduinoasisp.protocol=stk500v1
 arduinoasisp.speed=19200
 arduinoasisp.program.protocol=stk500v1
 arduinoasisp.program.speed=19200
 arduinoasisp.program.tool=avrdude
 arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}
 usbGemma.name=Arduino Gemma
 usbGemma.protocol=arduinogemma
 usbGemma.program.tool=avrdude
 usbGemma.program.extra_params=
 usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf
 stk500.name=Atmel STK500 development board
 stk500.communication=serial
 stk500.protocol=stk500
 stk500.program.protocol=stk500
 stk500.program.tool=avrdude
 stk500.program.extra_params=-P{serial.port}
 buspirate.name=BusPirate as ISP
 buspirate.communication=serial
 buspirate.protocol=buspirate
 buspirate.program.protocol=buspirate
 buspirate.program.tool=avrdude
 buspirate.program.extra_params=-P{serial.port}
 runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 runtime.tools.avrdude-6.0.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 runtime.tools.avr-gcc-4.8.1-arduino5.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 upload.maximum_size=30720
 upload.maximum_data_size=2048
 upload.speed=57600
 bootloader.high_fuses=0xDA
 bootloader.extended_fuses=0x05
 bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
 build.mcu=atmega328p
 runtime.vm.boardinfo.id=diecimila_atmega328
 runtime.vm.boardinfo.name=diecimila_atmega328
 runtime.vm.boardinfo.desc=Arduino Duemilanove or Diecimila w/ ATmega328
 runtime.vm.boardinfo.src_location=C:\Program Files (x86)\Arduino\hardware\arduino\avr
 ide.hint=For use with Arduino.cc 1.6.2+ ide
 ide.location.key=Arduino16x
 ide.location.ide.winreg=Arduino 1.6.x Application
 ide.location.sketchbook.winreg=Arduino 1.6.x Sketchbook
 ide.location.sketchbook.preferences=sketchbook.path
 ide.default.revision_name=1.6.9
 ide.default.version=10609
 ide.default.package=arduino
 ide.default.platform=avr
 ide.multiplatform=true
 ide.includes=arduino.h
 ide.exe_name=arduino
 ide.platformswithoutpackage=false
 ide.includes.fallback=wprogram.h
 ide.extension=ino
 ide.extension.fallback=pde
 ide.versionGTEQ=160
 ide.exe=arduino.exe
 ide.hosts=atmel
 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
 runtime.platform.path=C:\Program Files (x86)\Arduino\hardware\arduino\avr
 vm.platformname.name=avr
 build.arch=AVR
 build.architecture=avr
 vmresolved.compiler.path=C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\
 vmresolved.tools.path=C:\Program Files (x86)\Arduino\hardware\tools\avr
 " 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="COM5" visualmicro.platform.name="avr" arduino.build.core="arduino" /> </VisualStudio> </ProjectExtensions> </Project>
Robot.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="functions.ino" /> <None Include="routine.ino" /> <None Include="..\Shared\nrf24communication.ino" /> <None Include="Robot.ino" /> <None Include="..\Shared\CommandBook.ino" /> </ItemGroup> <ItemGroup> <ClInclude Include="__vm\.Robot.vsarduino.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> </Project>
functions.ino
//////////////////////////////////////// //////ARM AND GRABBER FUNCTIONS///////// //////////////////////////////////////// void armNeutral() { debugln("Arm to neutral position"); servoArm.write(armNeutralPosition); //neutral position armPos = armNeutralPosition; delay(100); } void grabberNeutral() { debugln("Grabber to neutral position"); servoGrab.write(grabberNeutralPosition); //neutral position grabPos = grabberNeutralPosition; delay(200); } void grabberGrab() { debugln("Grabbing"); servoGrab.write(180); delay(1000); servoGrab.write(grabberGrabPosition); //Grab (and move up arm?) delay(1000); } void grabberTurnPos(int pos) { debug("Grabber to position "); debugln(pos); servoGrab.write(pos); //servo position delay(100); } void armTurnPos(int pos) { debug("Arm to position "); debugln(pos); servoArm.write(pos); //servo position delay(100); } void resetServos() { debugln("Resetting servo"); delay(80); servoGrab.write(grabPos + 1); servoArm.write(armPos + 1); delay(20); servoGrab.write(grabPos); servoArm.write(armPos); } void leBlink(int ledPin, int n) { for (int i = 0; i < n; i++) { digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW delay(100); // wait for a second } } /*not used void setTemperatureAlarm(int temp) { sensors.setLowAlarmTemp(motorShaftTemp, -10); sensors.setHighAlarmTemp(motorShaftTemp, temp); } void checkAlarm() { if (sensors.hasAlarm()) { Serial.println("ALARM ON MOTOR 1"); } }*/
routine.ino
void r_Cut() { grabberGrab(); for (int i = 0; i < 20; i++) { armTurnPos(armPos + 45); delay(200); armTurnPos(armPos - 45); delay(200); } delay(500); grabberNeutral(); armTurnPos(armPos); } void r_Grab() { grabberGrab(); grabberNeutral(); armTurnPos(armPos); } void r_RPMtester(AccelStepper driver) { Serial.println(F("Testing RPM:")); Serial.print(F(" -Max speed: ")); Serial.println(driver.maxSpeed()); for (int i = 100; i < 500; i += 50) { Serial.print(F(" -Acceleration: ")); Serial.println(i); driver.setAcceleration(i); driver.move(500 * stepsPerRevolution); while (driver.distanceToGo()) driver.run(); Serial.println(F("Starting next iteration in 1 second")); delay(1000); } Serial.println(F("Nope....Test is over. Resuming in 3 seconds")); delay(3000); } void r_DirectionTest() { Serial.println(F("Testing Drirectoion:")); Serial.println(F("------------------")); Serial.println(F("Arm motor +")); armStepper.move(50); armStepper.runToPosition(); armStepper.move(-50); armStepper.runToPosition(); armStepper.disableOutputs(); Serial.println(F("Shaft motor +")); shaftStepper.move(50); shaftStepper.runToPosition(); shaftStepper.move(-50); shaftStepper.runToPosition(); shaftStepper.disableOutputs(); Serial.println(F("Kop motor +")); kopStepper.move(50); kopStepper.runToPosition(); kopStepper.move(-50); kopStepper.runToPosition(); kopStepper.disableOutputs(); } void r_MovePlant(int plant) { kopStepper.moveTo((int)200*plant); kopStepper.runToPosition(); }
CommandBook.ino
int countCommand(CommandBook *book) { int c = 0; while (book[c].command != NULL && c < BOOKSIZE) c++; return c; } bool addCommand(CommandBook *book, char command, int value) { int c = countCommand(book); if (c >= BOOKSIZE) { return false; } book[c].command = command; book[c].value = value; return true; } #ifndef BASESTATION void runCommand(CommandBook *book) { int c = countCommand(book); for (int i = 0; i < c; i++) { switch (book[i].command) { case 't': { r_MovePlant(book[i].value); break; } case 'c': { r_Cut(); break; } case 'g': { r_Grab(); break; } case 'r': { r_MovePlant(0); break; } case 'W': { shaftStepper.enableOutputs(); shaftStepper.moveTo(900); shaftStepper.runToPosition(); shaftStepper.disableOutputs(); break; } case 'S': { shaftStepper.enableOutputs(); shaftStepper.moveTo(0); shaftStepper.runToPosition(); //shaftStepper.disableOutputs(); //Keeping the shaft on it's place ONE TIME ONLY FOR DEMO (MABYE 2-3, but check temperature) break; } case 'D': { armStepper.enableOutputs(); armStepper.moveTo(750); armStepper.runToPosition(); armStepper.disableOutputs(); break; } case 'A': { armStepper.enableOutputs(); armStepper.moveTo(0); armStepper.runToPosition(); armStepper.disableOutputs(); break; } case 'u': { armTurnPos(book[i].value); break; } case 'i': { grabberTurnPos(book[i].value ); break; } case 'd': { delay(book[i].value); break; } case 'm': { kopStepper.move(book[i].value); break; } default: // "undef" break; book[i].command = NULL; book[i].value = NULL; } Serial.print('-'); Serial.print(book[i].command); Serial.print('\t'); Serial.print(book[i].value); Serial.println("\tDone"); } Serial.println("All commands done."); } #endif // BASESTATION void printCommand(CommandBook *book) { int c = countCommand(book); Serial.println(F("Commandos in book:")); for (int i = 0; i < c; i++) { Serial.print('-'); Serial.print(book[i].command); Serial.print('\t'); Serial.println(book[i].value); } Serial.println(F("-END OF COMMANDS")); } bool deleteCommand(CommandBook *book) { int c = countCommand(book); if (c == 0) { return false; } book[c - 1].command = NULL; book[c - 1].value = NULL; return true; } bool sendCommand(CommandBook *book) { int c = countCommand(book); uint8_t* buf = new uint8_t[BOOKSIZE * 3 + 1]; buf[0] = c; for (int n = 0; n < c; n += 1) { buf[(n * 3) + 1] = (uint8_t) book[n].command; buf[(n * 3) + 2] = (uint8_t) (book[n].value >> 8); buf[(n * 3) + 3] = (uint8_t)(book[n].value & 0xFF); } Serial.println(F("Sending message...")); bool result = nrf24SendMessage(buf, c * 3 + 1); delete buf; return result; }
nrf24communication.ino
#include <RHReliableDatagram.h> #include <RH_NRF24.h> #include <SPI.h> #define CLIENT_ADDRESS 1 #define SERVER_ADDRESS 2 // Singleton instance of the radio driver RH_NRF24 driver; // RH_NRF24 driver(8, 7); // For RFM73 on Anarduino Mini // Class to manage message delivery and receipt, using the driver declared above RHReliableDatagram manager(driver); bool isServer; uint8_t _nrf24_buf[32]; uint8_t _nrf24_blen = 0; bool nrf24Initialize(bool server) { Serial.print(F(" -Initiating radio:\t")); if (manager.init()) { Serial.println(F("OK")); Serial.print(F(" -Setting radio channel:\t")); if (!driver.setChannel(1)) { return false; Serial.println(F("setChannel failed")); } else { Serial.println(F("Channel 1")); } Serial.print(F(" -Setting radio settings:\t")); if (!driver.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm)) { Serial.println(F("setRF failed")); return false; } else { Serial.println(F("2Mbps, 0dBm")); } } else { Serial.println(F("FAILED!!!")); return false; } if (server) { manager.setThisAddress(SERVER_ADDRESS); } else { manager.setThisAddress(CLIENT_ADDRESS); } isServer = server; return true; } bool compareBuffers(uint8_t *buf1, uint8_t *buf2, uint8_t len) { for (uint8_t n = 0; n < len; n += 1) { if (buf1[n] != buf2[n]) { return false; } } return true; } void nrf24DebugPrint(char* str) { if (true) { Serial.println(str); } } bool nrf24ReceiveMessage(uint8_t* str, uint8_t* len) { uint8_t from; if (!manager.waitAvailableTimeout(3000)) { return false; } if (!manager.recvfromAck(str, len, &from)) { debugln(F("Couldn't receive message")); return false; } uint8_t* _nrf24_buf = (uint8_t *) "OK"; if (manager.sendtoWait(_nrf24_buf, 3, from)) { return true; } debugln(F("Did not receive acknowledgement on 'OK'")); return false; } bool nrf24SendMessage(uint8_t* str, uint8_t len) { uint8_t address = SERVER_ADDRESS; if (isServer) { address = CLIENT_ADDRESS; } if (!manager.sendtoWait(str, len, address)) { debugln(F("No acknowledgement received")); return false; } if (!manager.waitAvailableTimeout(1000)) { return false; } uint8_t from; if (manager.recvfromAck(_nrf24_buf, &_nrf24_blen, &from)) { return true; } debugln(F("Could not receive 'OK'")); return false; } bool radioSleep() { driver.setModeIdle(); if (driver.sleep()) { return true; } else return false; }