invalid conversion problem

i have an error
but i dont understand and i have no skill in electronics and i have an arduino uno r3 from creation crate(not sure if that changes anything)my project is a memory game and here in my code so far. thanks!

const int button1=2;
const int button2=3;
const int button3=4;
const int button4=5;
const int led1=7;
const int led2=8;
const int led3=9;
const int led4=10;
const int buzzer=12;
const int tones[]={1900,1600,1300,1000,3200};
int buttonState[]={0,0,0,0};
int lastButtonState[]={0,0,0,0};
int buttonCounter[]={0,0,0,0};
int game0n=0;
int wait=0;
int currentLevel=1;
int dlay=500;
int ledTime=500;
int n_levels=10;
int pinAndTone=0;
int correct=0;
int speedFactor=5;
int ledDelay=200;

void playTone(int tone(), int duration) {
for(long i=0; i<duration*1000L; i+=tone()*2)
{
digitalWrite(buzzer,HIGH);
delayMicroseconds(tone);
digitalWrite(buzzer,LOW);
delayMicroseconds(tone);
}

Please post your full code between
** **[code]** **
and
** **[/code]** **
.

Please provide the full error message; if the above is your full code, you're missing setup() and loop().

void playTone(int tone(), int duration) {
  for(long i=0; i<duration*1000L; i+=tone()*2)

Why do you have parenthesis after tone?

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks... Tom... :slight_smile:

okay now i get the following error message

/tmp/961973469/build/../../core/core_Intel_arc32_arduino_101_ce7885b3d89440f4810c5db77fdcac10.a(main.cpp.o): In function main': /home/builder/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/main.cpp:43: undefined reference to setup'
/home/builder/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/main.cpp:47: undefined reference to `loop'
collect2: error: ld returned 1 exit status
exit status 1

so what does it mean?

bobskelebone:
okay now i get the following error message

/tmp/961973469/build/../../core/core_Intel_arc32_arduino_101_ce7885b3d89440f4810c5db77fdcac10.a(main.cpp.o): In function main': /home/builder/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/main.cpp:43: undefined reference to setup'
/home/builder/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/main.cpp:47: undefined reference to `loop'
collect2: error: ld returned 1 exit status
exit status 1

so what does it mean?

Your sketch does not contain the setup() and loop() functions.

cool thanks

I suggest that you start with some example sketches and see if you can figure out what is common between all of them. You don't even have to compile them.

sterretje:
I suggest that you start with some example sketches and see if you can figure out what is common between all of them. You don't even have to compile them.

k thx for the tip

i have another error
error(incompatible types in assignment of ‘long int’ to ‘int [(((sizetype)(((ssizetype)n_levels) + -1)) + 1)]’)

updated code:

pinMode(button1,INPUT);
pinMode(button2,INPUT);
pinMode(button3,INPUT);
pinMode(button4,INPUT);
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
pinMode(buzzer,OUTPUT);
}
void loop(){
int n_array[n_levels];
int u_array[n_levels];
int i;
if(game0n==0){
for(i=0; i<n_levels; i=i+1){
n_array*=0;*
u_array*=0;
n_array=random(0,4);
_
}_
_
game0n=1;_
_
}_
_
}*_
*note this code is not complete

Maybe something like

n_array[i]=0;

Why is your code partially in italics? Use code tags as explained in reply #1.

I ask again, please post full code.

Lets not do this.

Post the entire well formatted code, in code tags, please?

Hi,

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.