abhijeetv2:
@Paul
The sensor is an LDR
Defined by you, earlier in the thread, as "Nothing on hardware side"
- LDR never gives a 0 value so I have used the <0
I gather you meant < 50, but it still doesn't answer the question of why values from 50 to 100 are considered a fail, but values from 0 to 49 are not. The other hadware, again part of the "Nothing on hardware side", is not shown. I can make an assumption that a LOW turns the motor on, and a HIGH (note spelling; not High, which causes your code to not compile) turns it off. If that's the case, your motor will run when sensorValue is >100, and if sensorValue drops to somewhere betwee 50 and 100 inclusive, it will not stop; and only print "Fail!". Your motor will only stop id the sensorValue is between 0 and 49.
- How about you join a school?
I have not seen in past couple of years someone advising me so dumb!!! So for future if you know nothing then atleast don't increase someone's hurdle more!
You came here for help. No, wait, you came here for a handout of some quick code.
Help was given, and though you didn't like the tone used in giving it, it was inded help. Don't like it? Go somewhere else.