noob error


I'm sorry, but I'm completely lost as to what I'm doing wrong here :l

Where are loop() and setup()?

here

and here

EDIT: There seems to be an extra pinmode setup in there, I have removed it now :o
Sorry for slow replies, this 5 minute filter is evil.

The \ at the end of your comment looks cute and symmetrical. But it also has a real meaning. It means ignore the carriage return right after it. So that next line is part of the comment.

In the future, post code not pictures of code. Cut and paste it into the post and put it in code tags. Don't say you don't know about code tags cause I know you wouldn't be posting without reading the how to use this forum post first and seeing point 7 about how to post code.

Thank you! I strive to make my code as cute and symmetrical as possible :smiley:

I thought if a line was commented out, the compiler wouldn’t read any of it. I’ve never seen this behaviour before.

By the way, I’m very sorry if posting pictures of code is against the rules! I am aware of the code tags, but pasting images was faster.

Use this format if you want to do that:

/*  symmetrical comments go here  */

/*
or for multiline
comments,
do this
*/

Kounipo:
By the way, I'm very sorry if posting pictures of code is against the rules! I am aware of the code tags, but pasting images was faster.

Faster for you, but much harder for the person trying to help you to read. And impossible to cut and paste from. If you are posting for your own edification, then post away with the pictures. If you actually want help with your code then you would do well not to try to make it harder for others to be able to read and work with the code so that they can help you.

Kounipo:
I thought if a line was commented out, the compiler wouldn't read any of it. I've never seen this behaviour before.

That is exactly right. And the \ symbol at the end of a comment means, "the comment continues on the next line too." It tells the compiler not to read the next line either.

CrossRoads:

/*  symmetrical comments go here  */

Thank you! I guess I'll have to use this from now on! Or just live with ugly comments :confused:

Delta_G:
That is exactly right. And the \ symbol at the end of a comment means, "the comment continues on the next line too." It tells the compiler not to read the next line either.

But that means the compiler is reading 1 character from a line I told it to ignore. Which brings up another question. What if I put a character after the \ ?

Kounipo:
Thank you! I guess I'll have to use this from now on! Or just live with ugly comments :confused:
But that means the compiler is reading 1 character from a line I told it to ignore. Which brings up another question. What if I put a character after the \ ?

No, the compiler never saw either line. Those were removed before it went to the compiler by the parser (or is it the preprocessor). One of the things it does is to look for comments and remove them. Since your line said that the next line was also a comment, it removed it.

Kounipo:
Thank you! I guess I'll have to use this from now on! Or just live with ugly comments :confused:

Is your goal to make artful text? Or working code? If it's working code you want then don't worry about how pretty the comments are. If it is artful text you want, then don't bother with coding it's just going to frustrate you. Stick to ascii art in that case.

What if

It’s very easy to try it out :wink:

Delta_G:
If it's working code you want then don't worry about how pretty the comments are. don't bother with coding it's just going to frustrate you.

Apologies if I'm mistaken, but are you suggesting I should give up because you disagree with my practice? Surely you'd agree that one of the most important things in programming is being able to debug your own code?

LarryD:
It's very easy to try it out :wink:

Don't worry, I have! I was simply thinking aloud!

Kounipo:
Apologies if I'm mistaken, but are you suggesting I should give up because you disagree with my practice? Surely you'd agree that one of the most important things in programming is being able to debug your own code?

I'm not saying you should give up because I don't agree. I'm just saying that you have a choice between pretty symmetrical comments or working code. You have a choice where to put your energy, making things pretty or making things work. Code that doesn't work is a bit useless. If you'd rather have pretty than working, then why bother with the code at all, just make ascii art. If you want to write code write code.

I do agree that being able to debug your code is of the ultimate importance. The "cuteness" of your comments doesn't affect that at all. You can debug code with normal comments in it. The only difference is whether or not the code will actually work. The choice is all yours. I make no judgement. I'm just filling you in on the fact that pretty-ing up your comments is what got you into trouble here. Worry less about that and more about the lines that actually do something or what the comment says and you'll find a better chance at success.

BTW, this may be something you might want to look through.

http://www.gammon.com.au/forum/?id=12153

See Trap#14. The problem you had discussed here.

.

Delta_G:
You have a choice where to put your energy, making things pretty or making things work. Code that doesn't work is a bit useless.

You're implying that pretty code doesn't work! I assure you, you're wrong :wink:

Delta_G:
being able to debug your code is of the ultimate importance. The "cuteness" of your comments doesn't affect that at all.

Maybe not for you :sunglasses: Can I just point out that I happened to stumble across the one exception, that applies to this language only? lol

Delta_G:
pretty-ing up your comments is what got you into trouble here.

You make a good point, but if my comments don't stand out to me, the development process takes much longer.

LarryD:
See Trap#14.

Well then...! :cold_sweat:

Kounipo:
I thought if a line was commented out, the compiler wouldn't read any of it. I've never seen this behaviour before.

There's a sequence of things that the compiler does when it reads your input file. Interpreting end-of-line escapes is one of the first things it does. Working out what is a comment and what isn't occurs quite a bit after this.

If you haven't seen that behaviour before, it's probably because you had a blank line after the comment.

PaulMurrayCbr:
a blank line after the comment.

Genius!!! My comments CAN BE PRETTY! :smiling_imp:

Kounipo:
Can I just point out that I happened to stumble across the one exception, that applies to this language only? lol

You "stumble" across a forty-plus year old language feature?

AWOL:
You "stumble" across a forty-plus year old language feature?

Why does it matter how old the language is? I've just started learning C, it could have been added last week and I'd still have stumbled over it :stuck_out_tongue: