error: variable or field 'inputs' declared void, PLEASE HELP

Hello guys,
Im new to c programing although im studing electronics and want to make a project were i can controls mutes on dsp using spi, although the code seams right i get this error code; error: variable or field 'inputs' declared void
Here is the code:
#include <SPI.h>

#include <SMARTGPU2.h> //include the SMARTGPU2 library

SMARTGPU2 lcd; //create our object called LCD

int PC = 40;
int aux =41;
int CD = 42;
int ps4 =43;

void setup(){
lcd.init(); //configure the serial and pinout of arduino board for SMARTGPU2 support
lcd.start(); // start SMARTGPU2
pinMode(40,INPUT);
pinMode(41,INPUT);
pinMode(42,INPUT);
pinMode(43,INPUT);

pinMode(4, OUTPUT);
SPI.begin(4);
SPI.setClockDivider(4, 16);//SETUP SPI SPEED 3Mhz yh slow...
SPI.setDataMode(4, SPI_MODE3); //setup SPI type
SPI.setBitOrder(4, MSBFIRST);
//PULL CLACH 3 TIMES turn dsps SPI on.
digitalWrite(4, LOW);
digitalWrite(4, HIGH);
digitalWrite(4, LOW);
digitalWrite(4, HIGH);
digitalWrite(4, LOW);
digitalWrite(4, HIGH);

;
};

void loop() {
lcd.baudChange(BAUD7);
lcd.imageBMPSD(0,0,"sunset");

};
void inputs (CD =1, aux =1, ps4 =1, PC=1){
if (CD = 1 ){
SPI.transfer(4,0b0000000,SPI_CONTINUE);
SPI.transfer(4,0xF000,SPI_CONTINUE);
SPI.transfer(4,0x0060, SPI_CONTINUE );//mute_1 adr
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_1 muted
SPI.transfer(4,0x00, SPI_CONTINUE );//mute_1 muted
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_1 muted
SPI.transfer(4,0x00);//mute_1 muted

SPI.transfer(4,0b0000000,SPI_CONTINUE);
SPI.transfer(4,0xF000,SPI_CONTINUE);
SPI.transfer(4,0x0061, SPI_CONTINUE );//mute_2 adr
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_2 muted
SPI.transfer(4,0x00, SPI_CONTINUE );//mute_2 muted
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_2 muted
SPI.transfer(4,0x00);//mute_2 muted

SPI.transfer(4,0b0000000,SPI_CONTINUE);
SPI.transfer(4,0xF000,SPI_CONTINUE);
SPI.transfer(4,0x0062, SPI_CONTINUE );//mute_3 adr
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_3 muted
SPI.transfer(4,0x00, SPI_CONTINUE );//mute_3 muted
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_3 muted
SPI.transfer(4,0x00);//mute_3 muted

SPI.transfer(4,0b0000000,SPI_CONTINUE);
SPI.transfer(4,0xF000,SPI_CONTINUE);
SPI.transfer(4,0x005F, SPI_CONTINUE );//mute_0 adr
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_0 unmuted
SPI.transfer(4,0x00, SPI_CONTINUE );//mute_0 unmuted
SPI.transfer(4,0x00 , SPI_CONTINUE );//mute_0 unmuted
SPI.transfer(4,0x01);//mute_0 unmuted
}; else
if (ps4 = 1 ){
SPI.transfer(4,0b0000000,SPI_CONTINUE);
and so on until all posible outcomes are defined....

If i put inputs into void loop i get : In function 'void loop()':
: error: 'inputs' was not declared in this scope
At global scope:
error: variable or field 'inputs' declared void

void inputs (CD =1, aux =1, ps4 =1, PC=1){

That is a function definition and is not done right. should be like

void inputs(int CD, int aux,int ps4,  int PC)

Then call the function from loop() with

inputs(1,1,1.1);

Please use control-t to format (indent) your code and post code using the code tags.

i have tried that before it didnt work but i didint tipe in input(1,1,1,1) in void loop before... i tiped it in and still got erro this time In function 'void inputs(int, int, int, int)':
error: expected primary-expression before ')' token

void loop() {
  lcd.baudChange(BAUD7);
lcd.imageBMPSD(0,0,"sunset");	
inputs(1,1,1,1);
		

};
void inputs(int CD, int aux,int ps4,  int PC){
if (CD = 1 ){

It would be helpful if you would post the exact error verbatim so the line number of the first error would show and at least all of the code of the function in question.

if (CD = 1 )

grief alert

Post your code.
Use code tags.

}; else

That semicolon will cause problems.

Pete

You need to spend some time with an introductory C programming text, as you don't know enough yet to understand the answers that are being given to you. For example:

void loop() {
  lcd.baudChange(BAUD7);
  lcd.imageBMPSD(0,0,"sunset");	
  inputs(1,1,1,1);
		

};                                             // <--- No semicolon is needed here..

void inputs(int CD, int aux,int ps4,  int PC){
if (CD = 1 ){                                  // <--- A single equal sign (=) is an assignment,
                                               // a double equal sign (==) is used in relational tests.

Also, use Ctrl-T to format you code before you post it. (You need to get it to compile before this works.)

I removed semicolns awere not needed and else comands as well as changed = to == still the same error , smart gpu library and a bit of code is there just for starting LCD its not been used at this stage.

#include <SPI.h>

#include <SMARTGPU2.h>     //include the SMARTGPU2 library

SMARTGPU2 lcd;             //create our object called LCD




void setup() {
  lcd.init();  //configure the serial and pinout of arduino board for SMARTGPU2 support
  lcd.start(); // start SMARTGPU2
  pinMode(40, INPUT);
  pinMode(41, INPUT);
  pinMode(42, INPUT);
  pinMode(43, INPUT);

  pinMode(4, OUTPUT);
  SPI.begin(4);
  SPI.setClockDivider(4, 16);//SETUP SPI SPEED 3Mhz yh slow... if waited for ppl to config 22Mhz...
  SPI.setDataMode(4, SPI_MODE3); //setup SPI type
  SPI.setBitOrder(4, MSBFIRST);
  //PULL CLACH 3 TIMES turn dsps SPI on.
  digitalWrite(4, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(4, HIGH);


}

void loop() {
  lcd.baudChange(BAUD7);
  lcd.imageBMPSD(0, 0, "sunset");
  inputs(1, 1, 1, 1);


}
void inputs(int CD, int aux, int ps4,  int PC) {
  if (CD == 1 ) {
    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0060, SPI_CONTINUE ); //mute_1 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00); //mute_1 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0061, SPI_CONTINUE ); //mute_2 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00); //mute_2 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0062, SPI_CONTINUE ); //mute_3 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00); //mute_3 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x005F, SPI_CONTINUE ); //mute_0 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 unmuted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_0 unmuted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 unmuted
    SPI.transfer(4, 0x01); //mute_0 unmuted
  };
  if (ps4 == 1 ) {
    SPI.transfer(4, 0b0000000, SPI_CONTINUE); //chip adress
    SPI.transfer(4, 0xF000, SPI_CONTINUE); //subadress
    SPI.transfer(4, 0x0061, SPI_CONTINUE ); //mute_2 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00); //mute_2 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0062, SPI_CONTINUE ); //mute_3 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00); //mute_3 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x005F, SPI_CONTINUE ); //mute_0 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00); //mute_0 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0060, SPI_CONTINUE ); //mute_1 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 inmuted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_1 unmuted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 unmuted
    SPI.transfer(4, 0x01); //mute_1 unmuted
  };
  if (PC == 1 ) {
    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x005F, SPI_CONTINUE ); //mute_0 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00); //mute_0 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0060, SPI_CONTINUE ); //mute_1 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00); //mute_1 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0062, SPI_CONTINUE ); //mute_3 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 muted
    SPI.transfer(4, 0x00); //mute_3 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0061, SPI_CONTINUE ); //mute_2 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 unmuted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_2 unmuted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 unmuted
    SPI.transfer(4, 0x01); //mute_2 unmuted

  };

  if (aux == 1 ) {
    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x005F, SPI_CONTINUE ); //mute_0 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_0 muted
    SPI.transfer(4, 0x00); //mute_0 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0060, SPI_CONTINUE ); //mute_1 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_1 muted
    SPI.transfer(4, 0x00); //mute_1 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0061, SPI_CONTINUE ); //mute_2 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_2 muted
    SPI.transfer(4, 0x00 ,); //mute_2 muted

    SPI.transfer(4, 0b0000000, SPI_CONTINUE);
    SPI.transfer(4, 0xF000, SPI_CONTINUE);
    SPI.transfer(4, 0x0062, SPI_CONTINUE ); //mute_3 adr
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 unmuted
    SPI.transfer(4, 0x00, SPI_CONTINUE ); //mute_3 unmuted
    SPI.transfer(4, 0x00 , SPI_CONTINUE ); //mute_3 unmuted
    SPI.transfer(4, 0x01); //mute_3 unmuted
  };
}

the full error mesage is: Arduino: 1.5.7 (Windows 7), Board: "Arduino Due (Programming Port)"

waver0.5.ino: In function 'void inputs(int, int, int, int)':
waver0.5.ino:167:23: error: expected primary-expression before ')' token
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
I defently will need to spend more time learning C++

In the IDE, in the bottom left corner, shows the line number that the cursor is on.

SPI.transfer(4,0x00 ,);//mute_2 muted

at line 166.

Thanks you a lot!!!!!!! :slight_smile: i spend about 5hours trying to figure this out and it was only few sipmple(stupid/noobie) mistakes...

I removed semicolns awere not needed

Not completely - there are still a number of these:

};

Not completely - there are still a number of these:

But, they don't hurt anything. They are not needed, but they do not cause problems.