Go Down

Topic: function, Does void x() need (Read 1 time) previous topic - next topic

Delta_G


Quote
If the function is supposed to return void, then it should not have a return statement

Wrong.
A void function can have a "return;"


Did you miss the part after the OR in my post?

Or can just say return;

If you don't have a return statement in a void function it will compile just fine.  Try it.  No return necessary.

AWOL

Quote
Did you miss the part after the OR in my post?

No I didn't miss your incorrect "return void;"
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

wildbill

Pressed and activate get set afresh every time you call relayDelay, so you always call t1.reset. Make them global, or better, static. I'm not sure you need them both either, try it without activate. Put the digitalWrite back in the function and drop the return. Any better?

Delta_G


Quote
Did you miss the part after the OR in my post?

No I didn't miss your incorrect "return void;"


But that's not the part you quoted is it? 

Sorry for the typo, yes the void should not be there.  Happened when I started writing, "if you want to return void" and then editing.

My bad. 

Groove

A 'typo' would be "return viod;", surely?  ;)
Per Arduino ad Astra

Go Up