..
I haven't got a clue what your code is trying to do either from the C or your description. You can only write code once you understand the intended function. I was given this criticism at university and it is essential learning.
Begin with creating a flow chart, in electronics this is equivalent to a 'state machine'. It's outdated but you need it!
Practical questions:
What sensor readings correspond to an object?
What do you mean by 'pass an object'? The sensor only reads one value at a time, how does passing an object come out?
Thank you for your reply I appreciate the time, I have a question for you if you don't mind. Are you here to criticize or help ? I am totally new to the programming language, and as far as I know, nobody was born Knowing it all
I'm sorry if I'm blunt, in amongst the criticism there is a suggestion
Try and make a flow chart of the intended code function, it was the technique used in the early days of computer programming and electronics. It is still used for learning and documentation.
Without understanding what you are trying to do it's hard to see where the code is going wrong to fix it.
Nekle_Tech:
..
Please don't blank out questions once they are answered.
First of all it looks like the TO is cross-posting in this forum:
Original title of this thread:
Help ASAP with IR sensor and stopping the motor at the right time PLEASE!
Title of his other thread of today:
Help Making motor stop via IR Sensor (KeyesIR)
And deleting the original question is not the first time in this thread.
He did the same here:
http://forum.arduino.cc/index.php?topic=323088.msg2232651#msg2232651
and here:
http://forum.arduino.cc/index.php?topic=322871.msg2231394#msg2231394
Dealt with him, thanks for the heads-up.