Hi all,
This is very probably a simple question but I just can’t get my head around it so here goes,
I want to check the status of an output (OS) as well as the condition of a variable (rpm) before executing the command. Something like this,
if ((rpm < 915) && (digitalRead(OS, = LOW)))
digitalWrite(US, HIGH); // Underspeed Alarm at 915 rpm
This however results in the following error
exit status 1
expected primary-expression before ‘=’ token
any ideas as to what I’m doing wrong?? Many thanks, Bob.
system
April 14, 2017, 2:13pm
#2
if ((rpm < 915) && (digitalRead(OS) == LOW)))
Thanks for you rapid response AWOL, I’ve tried this,
if ((rpm < 915) && (digitalRead(OS) == LOW)))
digitalWrite(US, HIGH); // Underspeed Alarm at 915 rpm
but still have this error,
exit status 1
expected primary-expression before ‘)’ token
what have I missed?
Looks like mis-matched quantity of ( vs ).
I count 4 (, but 5 ).
Try deleting one from the right-hand end.
Brilliant, thanks Crossroads, it had to be something simple, that's all my brain can handle
If you position the IDE cursor after a bracket of any kind the IDE will show you where the other one of the pair is.
In earlier versions of the IDE you could double click after a bracket and the IDE would highlight the code between them, which was very useful. Sadly some idiot removed this at some point.