Hi, I am writing code to control a stepper and some servos, I'm sure this is just a simple mistake but i can't work out where I have gone wrong. the error reads:
"a function-definition is not allowed here before '{' token"
/*
*
#### # #### ##### ## #
# # # # # # # # # #
# # # # ##### # # #
# ### # # # # # ###### #
# # # # # # # # # #
#### ###### #### ##### # # ######
*/
//Include the Librarys
#include <Stepper.h>
#include <Servo.h>
/*
_ _ _ _ _
__ _ ___ _ _ ___ _ _ __ _| |_(_)___ _ _ __ ____ _ _ _(_)__ _| |__| |___ ___
/ _` / -_) ' \/ -_) '_/ _` | _| / _ \ ' \ \ V / _` | '_| / _` | '_ \ / -_|_-<
\__, \___|_||_\___|_| \__,_|\__|_\___/_||_| \_/\__,_|_| |_\__,_|_.__/_\___/__/
|___/
*/
int sl = 1;
int seed = 59;
int inputsl = 10;
/* _
___ ___ _ ___ _____ ___ ___| |_ _ _ _ __
(_-</ -_) '_\ V / _ \ (_-</ -_) _| || | '_ \
/__/\___|_| \_/\___/ /__/\___|\__|\_,_| .__/
|_|
*/
Servo up;
Servo pinch;
/*
*
_ _
__| |_ ___ _ __ _ __ ___ _ _ ___ ___| |_ _ _ _ __
(_-< _/ -_) '_ \ '_ \/ -_) '_| (_-</ -_) _| || | '_ \
/__/\__\___| .__/ .__/\___|_| /__/\___|\__|\_,_| .__/
|_| |_| |_|
*/
// Number of steps per internal motor revolution
const float STEPS_PER_REV = 32;
// Amount of Gear Reduction
const float GEAR_RED = 64;
// Number of steps per geared output rotation
const float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED;
// Define Variables
// Number of Steps Required
int StepsRequired;
// Create Instance of Stepper Class
// Specify Pins used for motor coils
// The pins used are 14,15,16,17
// Connected to ULN2003 Motor Driver In1, In2, In3, In4
// Pins entered in sequence 1-3-2-4 for proper step sequencing
Stepper steppermotor(STEPS_PER_REV, 14, 16, 15, 17);
/*
_ _ _ _ _ _
| |_ _ _ __ _ __| |_(_)_ _ __ _ __ ____ _ _ _(_)__ _| |__| |___ ___
| _| '_/ _` / _| / / | ' \/ _` | \ V / _` | '_| / _` | '_ \ / -_|_-<
\__|_| \__,_\__|_\_\_|_||_\__, | \_/\__,_|_| |_\__,_|_.__/_\___/__/
|___/
*/
String clawside = "b";
String baseside = "d";
/*
_
_ __ _ _ ___ __ ___ __| |_ _ _ _ ___ ___
| '_ \ '_/ _ \/ _/ -_) _` | || | '_/ -_|_-<
| .__/_| \___/\__\___\__,_|\_,_|_| \___/__/
|_|
*/
void clock() // Clockwise 1/4 turn
{
StepsRequired = - STEPS_PER_OUT_REV / 4;
steppermotor.setSpeed(700);
steppermotor.step(StepsRequired);
}
void clock2() // Clockwise 1/2 turn
{
StepsRequired = - STEPS_PER_OUT_REV / 2;
steppermotor.setSpeed(700);
steppermotor.step(StepsRequired);
}
void aclock() // Anti-Clockwise 1/4 turn
{
StepsRequired = STEPS_PER_OUT_REV / 4;
steppermotor.setSpeed(700);
steppermotor.step(StepsRequired);
}
void aclock2() // Anti-Clockwise 1/2 turn
{
StepsRequired = STEPS_PER_OUT_REV / 2;
steppermotor.setSpeed(700);
steppermotor.step(StepsRequired);
}
void open() //Release jaws
{
pinch.write(180);
}
void close() //Squeeze jaws
{
pinch.write(0);
}
void lift() //Lift jaws
{
up.write(180);
}
void drop() //Drop jaws
{
up.write(0);
}
void flip() {
void close();
void lift();
void open();
void drop();
}
/*
###### ######## ######## ## ## ########
## ## ## ## ## ## ## ##
## ## ## ## ## ## ##
###### ###### ## ## ## ########
## ## ## ## ## ##
## ## ## ## ## ## ##
###### ######## ## ####### ##
*/
void setup()
{
/*
*
_
___ ___ _ ___ _____ ___ ___| |_ _ _ _ __
(_-</ -_) '_\ V / _ \ (_-</ -_) _| || | '_ \
/__/\___|_| \_/\___/ /__/\___|\__|\_,_| .__/
|_|
*/
up.attach(11); //sets lifting servo control to pin 11
pinch.attach(10); //sets pinching servo control to pin 10
//(Stepper Library sets pins as outputs)
/*
_ _ _
___ __ _ _ __ _ _ __ | |__| |___ ___ ___| |_ _ _ _ __
(_-</ _| '_/ _` | ' \| '_ \ / -_) (_-</ -_) _| || | '_ \
/__/\__|_| \__,_|_|_|_|_.__/_\___| /__/\___|\__|\_,_| .__/
|_|
*/
randomSeed(seed);
Serial.begin(9600);
/*
_ _ _ _
___ __ _ _ __ _ _ __ | |__| |___ _____ _____ __ _ _| |_(_)___ _ _
(_-</ _| '_/ _` | ' \| '_ \ / -_) / -_) \ / -_) _| || | _| / _ \ ' \
/__/\__|_| \__,_|_|_|_|_.__/_\___| \___/_\_\___\__|\_,_|\__|_\___/_||_|
*/
// setup arrays
sl = inputsl + 1;
String scramletters[18] = {"L", "L'", "L2", "R", "R'", "R2", "U", "U'", "U2","D", "D'", "D2", "B", "B'", "B2", "F", "F'", "F2"};
String finalscramble[sl];
int scramblenumbers[sl];
//This randomises the numbers
for (int x = 0; x <= sl-1; x++){
scramblenumbers[x] = random(1, 18);
}
//printing numbers to the serial port
for(int i = 0; i < inputsl; i++) {
Serial.println(scramblenumbers[i]);
}
for(int y = 0; y < inputsl; y++) {
finalscramble[y] = scramletters[scramblenumbers[y]];
}
for(int z = 0; z < inputsl; z++) {
Serial.println(finalscramble[z]);
}
for(int a = 0; a < inputsl; a++) {
if(finalscramble[a] == "L") {
if(baseside == "d" && clawside == "b"){
void cclock();
void flip();
void close();
void cclock();
}
}
}
void loop() {
}
/*
*
## ####### ####### ########
## ## ## ## ## ## ##
## ## ## ## ## ## ##
## ## ## ## ## ########
## ## ## ## ## ##
## ## ## ## ## ##
######## ####### ####### ##
*/