confused with code

melody[33:0]={z, z, z, z, e5, d5, c5, cs5, cs5, e5, z, d5, c5, z, e5, z, d5, c5, cs5, cs5, c5, z, c5, z, c5, z, z, e5, d5, c5, e5, c5, b4, e5} int oneNote[33:0]={8, 8, 8, 8, 8, 8, 8, 4, 4, 2, 6, 8, 8, 8, 2, 6, 8, 8, 4, 4, 2, 6, 2, 6, 2, 6, 8, 8, 8, 8, 2, 2, 2, 2} int noteDuration[33:0]=(1/tempo)*15*oneNote[33:0] tone[inputPin3, melody[33:0], noteDuration[33:0]]

exit status 1 expected ']' before ':' token

Someone help please.

Please read the forum rules in the sticky posts and post your code according to the rules if you want help.

What was the actual error message? It came with specifics and line numbers and all that jazz. You paraphrased it and totally botched that. I'm not going to go hunting through all that unformatted and improperly posted code to try to figure out what it was.

When you post it please remove all the commentary. Short comments are OK. The novel that someone wrote in the middle there makes it hard to work with.

I'm not going to go hunting through all that unformatted and improperly posted code to try to figure out what it was.

The fact that there is a whole lot of code that is not in a function wasn't obvious?

I didn't even look. It hurt my eyes. It's not formatted where I can see the blocks and I didn't want to hunt the braces.

If OP can't be bothered to read instructions then I figure that alone is 90% of their problem. In this hobby reading documentation is crucial.

In this hobby reading documentation is crucial.

No argument from me on that score.

But that excludes a great portion of the modern population.

Arcaninemaster89: melody[33:0]={z, z, z, z, e5, d5, c5, cs5, cs5, e5, z, d5, c5, z, e5, z, d5, c5, cs5, cs5, c5, z, c5, z, c5, z, z, e5, d5, c5, e5, c5, b4, e5} int oneNote[33:0]={8, 8, 8, 8, 8, 8, 8, 4, 4, 2, 6, 8, 8, 8, 2, 6, 8, 8, 4, 4, 2, 6, 2, 6, 2, 6, 8, 8, 8, 8, 2, 2, 2, 2} int noteDuration[33:0]=(1/tempo)*15*oneNote[33:0] tone[inputPin3, melody[33:0], noteDuration[33:0]]

exit status 1 expected ']' before ':' token

Someone help please.

your code is not C/C++ valid syntax

Did half of the original post disappear?

OP, Please don’t make radical changes to your post after you’ve got comments. That’s just going to turn people off from trying to help you.

Delta_G: Did half of the original post disappear?

OP, Please don't make radical changes to your post after you've got comments. That's just going to turn people off from trying to help you.

Especially when the changes you make are making the code worse, instead of better.

 melody[33:0]

Interesting array syntax...

UKHeliBob: melody[33:0]

Interesting array syntax...

Quite normal in python. understanding-pythons-slice-notation (stackoverflow)

Whandall: Quite normal in python. understanding-pythons-slice-notation (stackoverflow)

So "starts at 33 and ends at zero"?

Maybe you get the array backwards than? Or an array consisting of the last and first element?

Anyway, a C++ compiler chokes on that code. ;)

Guys i just need to know what does that "exit status 1 expected ']' before ':' token" mean and how do i fix it. Also that i changed that 33 to a 34, and i think that's just how many notes there are in the melody and oneNote.

Feed your whatever code to a whatever compiler that supports such a syntax.

The avr-gcc that the normal Arduinos use, does not. It supports C++ only.

Your code looks like sick python to me.

What it means is the code is crap. It's not valid syntax for C / C++.

It means a) you haven't shown us all the code and b) you haven't even shown us all of the error messages that anyone putting that code fragment into the Arduino IDE compiler gets. Even with that little snippet you got quite a few of them and that's because wherever you found that code it isn't Arduino code.

Steve

Arcaninemaster89: Guys i just need to know what does that "exit status 1 expected ']' before ':' token" mean and how do i fix it. Also that i changed that 33 to a 34, and i think that's just how many notes there are in the melody and oneNote.

Exit status 1 means that there was an error during the compiler run.

Expected ] before : means that the compiler was expecting to find a closing bracket but instead found a colon and it didn't know what to do with that illegal syntax. Legal array syntax would have a [ and then some expression that evaluates to a number and then a ]. There is no reason a : should show up in there.

It's pretty self explanatory.