Infrared Sensor / Photo Electric Sensor - Not executing stop function


#1

Hi,

When our coloured blocks are placed onto the conveyor and move down the belt, the infrared sensor fails to recognise the block when it passes by and stop.

We have checked the connections and all are correctly attached as per the diagram. We have checked that the senor is working and it detects items in front of it by lighting the rear red light when the script is run. It just doesn’t stop the conveyor belt to start the next function. Any ideas why? We are using the blockly example code straight from the website.

Cheers


#2

Further to this comment, I have attached a picture of some code that we have found on this site that we have used in an attempt to get our infrared sensor to work. Can someone please help me?

From what I can gather, this code should run the conveyor belt when there is nothing sensed by the infrared sensor, but stop the conveyor belt 0.5sec after the infrared sensor senses something (ie. a block) on the belt?

Not sure where to go from here.

Thanks,
Mark