I've got this piece of code written to control camera pins (bonus, its expandible!) but when I go to check the code, it always returns this:
error: variable or field ‘shoot’ declared void
void shoot(model, mode){
if(model == canon){
switch(mode){
case auto:
AF = LOW;
delay(delayAF);
S = LOW;
delay(delayS);
S = HIGH;
AF = HIGH;
break;
case AF:
AF = LOW;
delay(delayAF);
break;
case S:
S = LOW;
delay(delayS);
break;
case AFclr:
AF = HIGH;
break;
case Sclr:
S = HIGH;
break;
case clr:
S = HIGH;
AF = HIGH;
break;
}
}
/*
if(model == nikon){
switch(shoot){
}
}
*/
return void;
}
It even does that without the 'void shoot' bit in there (I have it utilized in the code to work the way I would LIKE it to work). What am I not getting right here?
EDIT
Probably easier if everybody can see the whole code, right?
#include <Servo.h>
#include <Wire.h>
#include <LiquidTWI.h>
/*
//put data into variables to be used
"settings"
"camera"-> "canon" or "nikon" or whatever else
"card speed" 1-10 //or whatever is the fastest speed
"measurements"-> "metric" or "imperial"
"shutter speed"
"focal length"
"geotag" )--> "enable" (y/n)
"motion enabled tripod" )
"computer"
"IR"
"trigger"
--> "laser" ) "delay" +-milliseconds
"flash" )--> "sensitivity" //various scales
"sound" )
"intervalometer"
--> "manual"-> "set time" //set button tapped twice )-> "image limit" infinite, 0, 1,...n-1 //option for infinate before zero
"timed"-> "delay" dd:hh:mm:ss time format //click set to go to the next one)
"panorama" //steppers to be used on tripod mount
--> "horizontal" +-degrees
"vertical" +-degrees
"overlap" +-percent
"advanced settings"
"orientation"-- "landscape" or "portrait"
"frame delay" +-seconds //delay between images
"layer delay" +-seconds //if a timelapsed pano is wanted
"layer direction"-- "vertical" or "horizontal" //is a row or a column shot
*/
LiquidTWI lcd(0);
//arduino connections
//externally used I/O
#define AF 14
#define S 15
#define light 16
#define sound 17
//control buttons, all pulled high
#define shutter 6
#define set 7 //could be eliminated
#define back 8
#define sel 13
//panorama rig servo motors
Servo Rservo; //row servo
Servo Cservo; //column servo
//rotary encoder
const int rotaryA = 18; //pin doesnt matter
const int rotaryB = 19; //pin doesnt matter
int rotaryVal = 0;
int rotaryState = 0;
int lastRotaryState = 0;
//mode variables
int mode;
int interval;
int trigger;
int sensitivity1;
int sensitivity2;
int sensitivity3;
unsigned long delay1;
unsigned long delay2;
unsigned long delay3;
unsigned long delay4;
unsigned long delay5;
unsigned long delay6;
unsigned long delay7;
//other variables
int camera;
int shotcount;
int panototal;
int canon;
int super;
void rotary() { //changes the value of rotaryVal to reflect the amount of rotation
//read the second rotary pin
rotaryState = digitalRead(rotaryB);
//if rotaryState has changed, test where its at
if(rotaryState != lastRotaryState){
//if rotaryB is CW, rotaryVal is incremented
if(rotaryState == LOW)rotaryVal++; //switch to switch direction
//if rotaryB is CCW, rotaryVal is decremented
else rotaryVal--;
// save the current state as the last state, for next time through the loop
lastRotaryState = rotaryState;
}
}
void shoot(int model, int shootMode){
if (model == canon) {
switch (mode) {
case super:
AF = LOW;
delay(delayAF);
S = LOW;
delay(delayS); //need to read shutter speed from camera and adjust accordingly
S = HIGH;
AF = HIGH;
break;
case bulb:
//catch rising edge of shutter button
//catch second falling edge of shutter button
break;
case AF:
AF = LOW;
delay(delayAF);
break;
case S:
S = LOW;
delay(delayS);
break;
case AFclr:
AF = HIGH;
break;
case Sclr:
S = HIGH;
break;
case clr:
S = HIGH;
AF = HIGH;
break;
}
}
/*
if(model == nikon){
switch(shoot){
}
}
*/
}
void setup(){
//set up the LCD
lcd.begin(16, 2);
lcd.print("Coming online...");
Serial.begin(9600);
//rotary encoder setup
pinMode(rotaryB, INPUT);
attachInterrupt(rotaryA, rotary, RISING);
//pin setup
pinMode(AF, OUTPUT);
pinMode(S, OUTPUT);
pinMode(shutter, INPUT);
pinMode(set, INPUT);
pinMode(back, INPUT);
pinMode(sel, INPUT);
//attach panorama servos
Rservo.attach(9);
Cservo.attach(10);
//shotcount variable set to 0
shotcount = 0;
//menu options
while(set == HIGH){ //when the SETUP button is pressed the menu option is exited
//menu controls
}
}
void loop() {
//if the "shutter" button is pressed on the control box, the command is sent to the camera
if(shutter == LOW); //debounce?
shoot(canon, super);
//if the shutter pin is low, the shotcount variable increaces by one
if(S == LOW) shotcount++;
//this prints the shotcount variable, a count of photos taken since the loop started
lcd.autoscroll();
lcd.print("Shots: ");
lcd.print(shotcount);
//the meat and potatoes of the program, this tells the camera what to do based on the settings
switch(mode){
//intervalometer
case 1:
if(interval == 1){
delay(delay1);
shoot(canon, super);
}
else if(interval == 2){ //settable
delay(delay2);
shoot(canon, super);
}
else{
return void;
}
//trigger activated
case 2:
switch(trigger){
case 1: //laser trigger
if(light <= sensitivity1){
delay(delay3);
shoot(canon, super);
}
break;
case 2: //flash trigger
if(light > sensitivity2){
delay(delay4);
shoot(canon, super);
}
break;
case 3: //sound trigger
if(sound ?? sensitivity3){
delay(delay5);
shoot(canon, super);
}
break;
}
break;
//computer control
case 3:
if (Serial.available() > 0) { //look for serial data
int trig = Serial.read(); //read serial
if(trig == ????) //if it recieves a specfic signal, shoot
shoot(canon, super);
break;
//panorama
case 4:
int pano = panototal;
shoot(canon, AF);
for(int angle1 = 0; angle1 <= RC1max; angle1 += RC1deg){ //row/column increments the angle by the super amount(determined by landscape or portrait)
delay(delayRC1); //frame delay 1
for(int angle2 = 0; angle2 <= RC2max; angle2 += RC2deg){ //column/row increments the angle by the super amount(determined by landscape or portrait)
if(S == LOW) shotcount++; //increment the shot counter
pano -= shotcount;
//perhaps move this chunk elsewheree?
lcd.print("shots left: ");
lcd.print(pano);
lcd.print(" out of ");
lcd.print(panototal);
//lcd.clear();
delay(delayRC2); //frame delay 2
shoot(canon, S); //shoot 1 frame
delay(delayS);
shoot(canon, Sclr);
if(RC == R){ //if row/column variable (RC) is set to row (R), this loop will increment photos being taken by row
Rservo.write(a2); //if not it will increment by column
}
else{
Cservo.write(a2);
}
}
if(RC == R){ //if row/column variable (RC) is set to row (R), this loop will increment the photo loop by column
Cservo.write(a1); //if not, it will increment by row
}
else{
Rservo.write(a1);
}
}
shoot(canon, clr);
//blink led?
break;
}
}
}