void setup(){
pinMode(A5,OUTPUT);
}
tone(A5,200);
delay(1000);
tone(A5,225);
delay(400);
tone(A5,240);
delay(550);
tone(A5,200);
delay(700);
noTone(A5);
void loop(){
//Google how to define amount of times to loop
tone(A5,293);
delay(225);
tone(A5,285);
delay(225);
}
Hello
I am having trouble with this code. When I compile it, it gives me this error:
exit status 1
expected constructor, destructor, or type conversion before '(' token
Can you help me?
gfvalvo
December 31, 2018, 8:42pm
#2
You can't have executable code outside of any function.
it worked with other software
what should i put it in?
Robin2
December 31, 2018, 8:59pm
#4
BoeingLikesToDab:
it worked with other software
What other software?
what should i put it in?
In a function. Presumably it is meant to be inside loop() along with its look-alikes
…R
It's supposed to play only once, and I put it in setup, and it worked. Is that ok?
It worked in Let's Start Coding.
I'm sad, I know.
Setup is the perfect place to put something that must run once at power up. More importantly, if it does what you need, its ok! At least Until you want to add a feature that requires a complete rewrite
Robin2
December 31, 2018, 10:48pm
#7
BoeingLikesToDab:
It worked in Let's Start Coding.
I'm sad, I know.
There is no need to be defensive. However I don't know what "Let's Start Coding" is without a link to the website.
...R