Go Down

Topic: Error compiling (Read 1 time) previous topic - next topic

arduinohabib

I wrote a code for a one digit seven segment display(that took me a while) and when I try to upload to board it says "error compiling. Its driving me mad because there aren't any mistakes in the actual code and I have been trying to get a seven segment display to work for a while. What should I do? Please someone help me!
Thanks
P.S. this is the code:
Quote

#define a 13
#define b 12
#define c 11
#define d 10
#define e 9
#define f 8
#define g 7
#define dp 6 
void setup(){
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(d, OUTPUT);
  pinMode(e, OUTPUT);
  pinMode(f, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(dp, OUTPUT);
}
void loop(){
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  delay(1000);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(d, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(g, LOW);
  digitalWrite(e, LOW);
  digitalWrite(d, LOW);
  delay(1000);
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(g, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  delay(1000);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(f, LOW);
  digitalWrite(e, LOW);
  digitalWrite(g, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(f, LOW);
  digitalWrite(g, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(a, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  delay(1000);
  digitalWrite(a, LOW);
  digitalWrite(d, LOW);
  digitalWrite(f, LOW);
  digitalWrite(e, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
}

What is man's best friend? The breadboard!

pYro_65

Code: [Select]
// WCharacter.h prototypes
inline boolean isAlphaNumeric(int c) __attribute__((always_inline));


c is defined as a macro before arduino.h is included, use more... better names
Forum Mod anyone?
https://arduino.land/Moduino/

SurferTim

#2
Sep 29, 2012, 02:11 pm Last Edit: Sep 29, 2012, 02:13 pm by SurferTim Reason: 1
I know this sounds weird, but put another declaration before the defines. I used this and it compiled:
Code: [Select]
int test;
#define a 13
#define b 12
#define c 11
#define d 10
#define e 9
// and on...


edit: An #include before the defines compiles ok also.

pYro_65

This is a result of the IDE injecting '#include "Arduino.h" before what it thinks is the first line of ( actual ) code. Some pre-processors are overlooked, #includes are an exception as it uses these to collect library files.
Forum Mod anyone?
https://arduino.land/Moduino/

arduinohabib

Thank you everybody for the quick reply and your methods your methods all work!
What is man's best friend? The breadboard!

Go Up