Go Down

Topic: help with simple input/output code (Read 3991 times) previous topic - next topic


That's not what you said, or what I wrote.

What you've written is

if v2 < threshold OR v5 < threshold then pin is low, otherwise high. i.e. It's only high if BOTH of those inputs are greater than threshold.

What I said was:

if ( (v2 >= threshold) || (v5 >= threshold) )
    digitalWrite(12, HIGH);
   digitalWrite(12, LOW);


Umm... this was of no help if this is what your referencing to of what you said. So... what you're saying is..

If v2 >= threshold OR v5 >= threshold then light pin 12, otherwise make it low.

If v3 >= threshold OR v5 >= threshold then light pin 11, otherwise make it low.

there was no bracketing or code for an or command. It confirmed that I was on the right track and got to basically the same code you have recently provided, Which is my code just completed and the low and high are switched around.

Don't get me wrong I appreciate the help, but can go without the snide statements.


You're not getting any snide comments - although I'll admit to getting a bit frustrated.

I'm trying to help, but I didn't sign up to write your entire project for you - or to teach you C.

I made the effort to describe the logic you could implement. I get that you've not programmed before - and I actually mean no disrespect at all. But it goes back to what I was trying to say earlier - a good C/C++ tutorial (away from Arduino) covering things like use of the operators, control flow statements, datatypes, pointers, classes & inheritence etc. will really get you moving a lot faster.


Anyway, did you get everything working?

If that was your first Arduino project then congrats. Maybe not the smoothest run, but it always feels good when that thing finally works.

Go Up