Hi all,
I'm teaching myself how to code while I work on this project and would like an idea as to where i should go with this section. Just looking for something as maybe "hey try learning this or these commands to make it work." Here is what I am trying to accomplish.
I have an 2x16 LCD on I2C bus and 2 position switch. The switch is basically 2 stages, a gentle push then a more firm push. both are N.C. So if you press it hard both switches should show open, but there is the possibility of internal failure so that there is a possibility that you can have the following closed, closed / open, open / open, closed / closed, open.
I would like the title of the test to remain on line 1 of the LCD and status indicators on the second line.
the code works well if I put a delay in but I do not want to incorporate a delay as it interfers with the rest of my code. and it's not pretty at all on the LCD as it just flashes insanely fast if I do not put a delay. Any ideas, suggestions or questions will be welcomed and answered. This is the section of code I am working. I will do a follow up post with the full code. Thank you in advance.
while ((selVal >= 783) && (selVal <= 793)) // 4 O'CLOCK POSITION
{
lls1Val = digitalRead(lls1Pin);
lls2Val = digitalRead(lls2Pin);
lcdblue.setCursor (0,0);
lcdblue.print("LOWER LMT SWITCH");
if ((lls1Val == HIGH) && (lls2Val == HIGH))
{lcdblue.setCursor (0,1);
lcdblue.print(" 1 1 ");}
delay (500);
if ((lls1Val == HIGH) && (lls2Val == LOW))
{lcdblue.setCursor (0,1);
lcdblue.print(" 1 0 ");}
delay (500);
if ((lls1Val == LOW) && (lls2Val == HIGH))
{lcdblue.setCursor (0,1);
lcdblue.print(" 0 1 ");}
else
{lcdblue.setCursor (0,1);
lcdblue.print(" 0 0 ");}
break;}