Pages: 1 [2]   Go Down
Author Topic: help with simple input/output code  (Read 1506 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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);
else
    digitalWrite(12, LOW);
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 0
Posts: 304
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2]   Go Up
Jump to: