Arduino project 07 LIED TO ME!!
First thing in the code, It says to write what is in the photo.
but I get this error message:
"exit status 1
Compilation error: conflicting declaration 'int buttons [0]"
What is the problem here.

12 Replies
otherwise it's trying to redeclare the
buttons
arrayaltight
weird that it shows this wrongly
thanks
Compilation error: 'buttons' does not name a type
this is what I get now
you need to declare the
button
array as type int
eger
but you can only declare it once...int notes[6];
notes[0]=2;
i switched from button to notes
but it doesn't work
share the complete code, that makes no sense...
🧐
int buttons[6];
// set up an array with 6 integers
int buttons[0] = 2;
// give the first element of the array the value 2
int notes[] = {262,294,330,349};
void setup() {
Serial.begin(9600);
}
void loop() {
int keyVal = analogRead(A0);
Serial.println(keyVal);
if(keyVal == 1023){
tone(8, notes[0]);
}
else if(keyVal >= 990 && keyVal <= 1010){
tone(8, notes[1]);
}
else if(keyVal >= 505 && keyVal <= 515){
tone(8, notes[2]);
}
else if(keyVal >= 5 && keyVal <= 10){
tone(8, notes[3]);
}
else{
noTone(8);
}
there
Its arduino project number 07
a mini keyboard instrument
i don't see any need for
buttons
at all, that looks like it's reading a resistor divider on A0
int keyVal = analogRead(A0);
that code came out of a project book???I copied this code from the project book
tyy
You don’t need the Int for the second line