Hello,
I am running across an issue when I have tried implementing a menu to select which "recipe"(which is an array) to make, and then using that to control stepper motor positons, this uses Accelstepper library but I don't believe this will affect this issue.
The error is get is regarding setting moveToNext = recipeBeingMade[any number to get the steps in the recipe array] where it says cannot have type of 'int[int]'.
Apologies if I'm dumb and attempting to do something impossible, only just started coding.. Any ideas on how I could make this work, where I'm going wrong, or better ways of accomplishing this?
My code is long, but this is the relevant section to this question:
//Declaring
int recipeToBeMade;
int recipeBeingMade;
int recipeOne[] = { -1000, -4000, -10000, -300 };
int recipeTwo[] = { -3000, -10000, - 5000, -300 };
const byte recipeBeingMadeSize = sizeof(recipeBeingMade) / sizeof(recipeBeingMade[0]);
void selectRecipe()
{
int recipeInput;
do
{
Serial.println("Enter which recipe to make");
recipeInput = Serial.read();
Serial.println(recipeInput);
}
while (!Serial.available());
{
Serial.println("No serial data available");
//Wait
}
recipeToBeMade = recipeInput - '0';
switch (recipeInput)
{
case 1:
recipeBeingMade = recipeOne[];
break;
}
}
void executeRecipe()
{
if (conveyor.currentPosition() == 0)
{
if (recipeBeingMadeSize >= 1)
{
moveToNext = recipeBeingMade[0];
}
}
if (conveyor.currentPosition() == recipeBeingMade[0])
{
if (recipeBeingMadeSize >= 2)
{
moveToNext = recipeBeingMade[1];
}
}
}