function calling issue

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;
      }
   }
}

I don't you should do return void, or use that return statement at all. A void function doesn't return void. It simply can't run return with any parameter. You can do return, just don't include parameters with return. At the end of a function, it will return to the caller.

What I would like it to do is to sequence the AF and S pins on and off based on the parameters I've set out in the cases.

I guess what I want is to control a switch case within a switch case (ie model and mode) as a single function outside of void loop() instead of a pile of smaller snippets.

Remove that "return void"
Does it work now?

How about posting the whole thing? I can't even try to compile it without having the variable declarations.

Also this doesn't make sense (although it is commented out):

if(model == nikon){
  switch(shoot){
  }
 }

You can't switch on a function.

You can't switch on a function

You can...but the question is whether you should :stuck_out_tongue_closed_eyes:

(you're simply treating the function pointer as an "int" - you'll need a cast though)

That's switching on an int.

Just to elaborate, you can't switch on a float either.

However you can cast floats, functions, and other things (eg. pointers) to ints.

But that is two operations.

It is valid to cast a float to an int.
It is valid to switch on an int.

It isn't valid to switch on a float (or a function).

void shoot(model, mode){

The argument types are missing. The compiler has no idea what type the variable model or mode is.

How about posting the whole thing? I can't even try to compile it without having the variable declarations.

Also this doesn't make sense (although it is commented out):

The whole thing is looooong and makes little sense even to me, its also fairly out of order.
As for the commented out bit, that will be essentially the same except for how the arduino switches the pins (nikon does have a different trigger setup).

However you can cast floats, functions, and other things (eg. pointers) to ints.

Would you mind giving me an example Nick? I'm an eternal noob without examples to hack to pieces

Would you mind giving me an example

I don't think you really need an example at this point. The mode and model are sure to be ints or strings. How can you have a model 3.2? Or mode 7.1?

I don't think you really need an example at this point.

I don't know what to write, that's the problem.

I don't know what to write, that's the problem.

Do you have an example, not code necessarily - words would be fine, where you want to switch on a float?

Using a switch statement with floats is generally not done, since typically, you want to do something when a float value is within some range. For example, you want to turn the heater on when the temperature is below 65.0 degrees, and off when the temperature gets above 75.0 degrees.

Can you make a small example that uses this function, along with the declarations for canon, AF, S etc?

It's hard to give example code to you without knowing what you are trying to do.

As PaulS said, this is wrong for a start:

void shoot(model, mode){

You need a type (and we can only guess at what that might be). For example:

void shoot(int model, int mode){

or:

void shoot(float model, float mode){

or:

void shoot(byte model, byte mode){

Then we can go a bit further.

Ok so I played around with the code a bit and I've gotten it to stop hanging before the loop. now its giving me a primary-expression error :confused: it errors on that last line, can't figure out why.
AF = auto focus
S = shutter
this snippit it to control the auto-focus and shutter inputs on an SLR camera. it is part of an intervalometer project I'm working on.

void shoot(int model, int shootMode){
 int canon;
 if (model == canon) {
  switch (mode) {
    case auto:   //trigger and clear the AF and S pins in order

This here is how I intend to use the function

void loop() {
//if the "shutter" button is pressed on the control box, the command is sent to the camera
  if(shutter == LOW);
    shoot(canon, auto);{/code]

"auto" is a reserved word.

"auto" is a reserved word.

Changed all instances of that to "super"(and a few other random words), now its giving me a '" super' cannot appear in a constant-expression"

If you could just lean a little to your left, I can't quite see your code.

If you could just lean a little to your left, I can't quite see your code.

Iz sekrut!

void loop() {
//if the "shutter" button is pressed on the control box, the command is sent to the camera
  if(shutter == LOW);    
    shoot(canon, super);
if(shutter == LOW);

?

Actually, I meant all of it.
I don't do keyhole debugging.

Iz sekrut!

I had to google that one - I thought you were maybe Turkish.

If you don't want any help, shall I just lock this thread now, or move it to "Garbage"?