int A4 conflict declaration


hi guys, doing simple program produce c major scale, when creating interger variable "a4" store frequency 2272hz, "conflicting declaration 'int a4'. can fix problem putting in lower case.

however, interested in reason why happening

---------------------

the code bellow

---------------------

code: [select]
int c4 = 3830;
int d4 = 3400;
int e4 = 3038;
int f4 = 2864;
int g4 = 2550;
int a4 = 2272;
int b4 = 2028;
int c5 = 1912;

int duration = 500;
int pintone = 7;

void setup() {
 pinmode (pintone, output);
}

void tone(int period, int length) {
 long m = millis() + length;
 while(millis() < m) {
   digitalwrite(pintone, high);
   delaymicroseconds(period/2);
   digitalwrite(pintone, low);
   delaymicroseconds(period/2);
 }
}

void loop() {  
 tone(c4, duration);
 tone(d4, duration);
 tone(e4, duration);
 tone(f4, duration);
 tone(g4, duration);
 tone(a4, duration);
 tone(b4, duration);
 tone(c5, duration);
}


---------------------

thanks lot!
carlos

probably because there's a4 in 1 of headers arduino uses.
i'm guessing tone.h.
or maybe "papersizes.h"


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > int A4 conflict declaration


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums