Where is the error?


hi copying code make tutorial on 4digit counter , compiling error cant see, error says:-
   
     arduino: 1.6.3 (windows 7), board: "arduino uno"

build options changed, rebuilding all



c:\program files (x86)\arduino\hardware\tools\avr/bin/avr-g++ -c -g -os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -mmd -mmcu=atmega328p -df_cpu=16000000l -darduino=10603 -darduino_avr_uno -darduino_arch_avr -ic:\program files (x86)\arduino\hardware\arduino\avr\cores\arduino -ic:\program files (x86)\arduino\hardware\arduino\avr\variants\standard c:\users\jon\appdata\local\temp\build2735656613135180331.tmp\counter.cpp -o c:\users\jon\appdata\local\temp\build2735656613135180331.tmp\counter.cpp.o

counter.ino:30:41: error: 'f' not declared in scope

counter.ino: in function 'void setup()':

counter.ino:45:11: error: 'f' not declared in scope

error compiling.


the script far is:-


#define 2
#define b 3
#define c 4
#define d 5
#define e 6
#define f 7
#define g 8
#define dp 9

#define cc1 10
#define cc2 11
#define cc3 12
#define cc4 13

#define numbersegments {\
  {1,1,1,1,1,1,0,0},\
  {0,0,1,1,0,0,0,0},\
  {1,1,0,1,1,0,1,0},\
  {1,1,1,1,0,0,1,0},\
  {0,1,1,0,0,1,1,0},\
  {1,0,1,1,0,1,1,0},\
  {0,0,1,1,1,1,1,0},\
  {1,1,1,0,0,0,0,0},\
  {1,1,1,1,1,1,1,0},\
  {1,1,1,0,0,1,1,0}\
}

byte numbers[10][8] = numbersegments;
const int segments[8] = {a, b, c, d, e, f, g, dp};


void setup() {
  serial.begin(9600);
  pinmode(a, output);
  digitalwrite(a,low);
  pinmode(b, output);
  digitalwrite(b,low);
  pinmode(c, output);
  digitalwrite(c,low);
  pinmode(d, output);
  digitalwrite(d,low);
  pinmode(e, output);
  digitalwrite(e,low);
  pinmode(f, output);
  digitalwrite(f,low);
  pinmode(g, output);
  digitalwrite(g,low);
 
  pinmode(cc1, output);
  digitalwrite(cc1,high);
  pinmode(cc2, output);
  digitalwrite(cc2,high);
  pinmode(cc3, output);
  digitalwrite(cc3,high);
  pinmode(cc4, output);
  digitalwrite(cc4,high);

}

void loop() {
  // put main code here, run repeatedly:

}


i know right in front of me! if can excellent. numbers 30:41 , 45:11 in error message mean?

thanks help

for reasons can't begin speculate about, when changed "f" "x" everywhere compiles....


code: [select]
#define x 7

const int segments[8] = {a, b, c, d, e, x, g, dp};

pinmode(x, output);
digitalwrite(x,low);


Arduino Forum > Using Arduino > Programming Questions > Where is the error?


arduino

Comments