Timeline for LCD isn't working with if statement
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 24, 2017 at 1:48 | comment | added | Nick Gammon♦ | @Omar - the "answer" area is not for clarifying your question or replying to comments. This is not a forum. If you are asked a question in a comment, make a comment to reply. If you need to clarify your question edit the question. | |
Feb 23, 2017 at 14:25 | comment | added | user31225 | Okay my problem is that When it is<=8 it gives tank is full but when it becomes >=20 after the lcd remains tank is full so the lcd display isn't changing at all so please help me | |
Feb 23, 2017 at 3:17 | comment | added | gilhad |
@Omar: you read some distance to variable distance . So this variable now contain some more/less random long number. Then you call digitalRead(distance) where you read pin with this number - so you read some random (maybe even non-existent) pin. With digitalRead you read digital, so result is else HIGH or LOW (which are 1 or 0). And then you compare valoue of 1 or 0 (obtained from random pin) with values like 8 or 20. Do you see, why it does not work this way?
|
|
Feb 23, 2017 at 1:50 | comment | added | Andre Courchesne | Voted down. Please add more content, what is not working? | |
Feb 22, 2017 at 22:15 | answer | added | LegitimateWorkUser | timeline score: 1 | |
Feb 22, 2017 at 20:01 | comment | added | user31225 | But why it will not show any output | |
Feb 22, 2017 at 19:54 | comment | added | user31225 | I will try it Gerben, 6v6gt and thanks for the adviceπ | |
Feb 22, 2017 at 19:17 | comment | added | 6v6gt | Your collection of if statements has holes which could result in no output to the lcd. For example, if Grove_Water_Sensor is LOW and distance is 10 would result in no output. | |
Feb 22, 2017 at 19:10 | comment | added | Gerben |
You might want to change digitalRead(distance) >=20 to just distance >=20
|
|
Feb 22, 2017 at 19:09 | history | edited | Gerben | CC BY-SA 3.0 |
added 368 characters in body; edited title
|
Feb 22, 2017 at 19:00 | review | First posts | |||
Feb 24, 2017 at 3:28 | |||||
Feb 22, 2017 at 18:58 | history | asked | omar | CC BY-SA 3.0 |