Redefinition of void setup(){}

#include<SPI.h>
#include<Wire.h>

#define SDIN 0
#define SCLK 0
#define RES 0
#define SCE 0
#define DC 0

void setup(){
  
}

void loop(){
  
}

void Initiate(){
  pinMode(RES, OUTPUT); 
  pinMode(SCE, OUTPUT);
  pinMode(DC, OUTPUT);
  pinMode(SDIN, OUTPUT);
  pinMode(SCLK, OUTPUT);
  digitalWrite(RES, LOW);
  digitalWrite(RES, HIGH);
}

void SendData(byte DATA){
  digitalWrite(DC, HIGH);
  digitalWrite(SCE, LOW);
  shiftOut(SDIN, SCLK, MSBFIRST, DATA);
  digitalWrite(SCE, HIGH);
}

void SendCmd(byte CMD){
  digitalWrite(DC, LOW);
  digitalWrite(SCE, LOW);
  shiftOut(SDIN, SCLK, MSBFIRST, CMD);
  digitalWrite(SCE, HIGH);
}

ERROR MESSAGE

Arduino: 1.6.5 (Mac OS X), Board: “Arduino Micro”

Nokia.h.ino: In function ‘void setup()’:
Nokia.h:10: error: redefinition of ‘void setup()’
Nokia.h:10: error: ‘void setup()’ previously defined here
Nokia.h.ino: In function ‘void loop()’:
Nokia.h:11: error: redefinition of ‘void loop()’
Nokia.h:14: error: ‘void loop()’ previously defined here
Nokia.h.ino: In function ‘void Initiate()’:
Nokia.h:13: error: redefinition of ‘void Initiate()’
Nokia.h:18: error: ‘void Initiate()’ previously defined here
Nokia.h.ino: In function ‘void SendData(byte)’:
Nokia.h:23: error: redefinition of ‘void SendData(byte)’
Nokia.h:28: error: ‘void SendData(byte)’ previously defined here
Nokia.h.ino: In function ‘void SendCmd(byte)’:
Nokia.h:30: error: redefinition of ‘void SendCmd(byte)’
Nokia.h:35: error: ‘void SendCmd(byte)’ previously defined here
redefinition of ‘void setup()’

Any idea why it's not working? :frowning:

I can compile your code without any error.

You've done 20 posts, but are not following the guidelines written by Nick Gammon in his two posts at the top of this Forum. Read those and start posting your code correctly.

I can create that error easily. Create that same code and save it as two different file names, then use "Sketch - Add File" to add the second file to the first.

Here I used sketch_aug12b as the first file and sketch_aug12c as the second. Then I used "Sketch - Add File" to add sketch_aug12c to the original sketch_aug12b. This is the result.

sketch_aug12c.ino: In function 'void setup()':
sketch_aug12c:10: error: redefinition of 'void setup()'
sketch_aug12b:10: error: 'void setup()' previously defined here
sketch_aug12c.ino: In function 'void loop()':
sketch_aug12c:14: error: redefinition of 'void loop()'
sketch_aug12b:14: error: 'void loop()' previously defined here
sketch_aug12c.ino: In function 'void Initiate()':
sketch_aug12c:18: error: redefinition of 'void Initiate()'
sketch_aug12b:18: error: 'void Initiate()' previously defined here
sketch_aug12c.ino: In function 'void SendData(byte)':
sketch_aug12c:28: error: redefinition of 'void SendData(byte)'
sketch_aug12b:28: error: 'void SendData(byte)' previously defined here
sketch_aug12c.ino: In function 'void SendCmd(byte)':
sketch_aug12c:35: error: redefinition of 'void SendCmd(byte)'
sketch_aug12b:35: error: 'void SendCmd(byte)' previously defined here
redefinition of 'void setup()'

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

You must remove one of the files. There is probably two tabs in the IDE window, correct? You must go to your sketch folder, enter that sketch name folder (Nokia?) and remove the duplicate file.

SurferTim:
I can create that error easily. Create that same code and save it as two different file names, then use “Sketch - Add File” to add the second file to the first.

Here I used sketch_aug12b as the first file and sketch_aug12c as the second. Then I used “Sketch - Add File” to add sketch_aug12c to the original sketch_aug12b. This is the result.
You must remove one of the files. There is probably two tabs in the IDE window, correct? You must go to your sketch folder, enter that sketch name folder (Nokia?) and remove the duplicate file.

Thanks!
Also, sorry to the minimod. I should read up on the guidelines. It was a rushed post before I had to go to bed.
^-^’

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the “Code” icon above the posting area. It is the first icon, with the symbol: </>

You are including a file, Nokia.h, which has another definition of setup ().

You should only define setup() and loop() once in your sketch.

It turned out the problem was that each time I saved the file it opened a new tab that was a copy of the original.
Thanks for the help!
And sorry for being late, but I'll go ahead and add those code headers.