Problem with LDR-analog sensor

Hi!
I want to make rotate machine to filling plastics bottles. I have 2 buttons (1 to turn cycle on other 1 to turn off). If i press button on cycle starts working also turns on green LED and button off break cycle and red LED turns on. First is stepper motor which rotates the plate of bottels for example for 36 degrees then after delay starts work DC motor which is actually a pump and fill bottle for example for 2 seconds. Then after this i have defer to loop cycle again and again. Now i have a problem. I want to insert in my cycle laser LED and LDR-photoresistor (i use analog sensor). I want to make if my LDR sensor detect a light of a laser LED to stop dc motor (pump) and i want to loop just stepper motor (which mean i dont have bottles in my cycle and stepper will spin until the bottle breaks the light of sensor) . If LDR not detect light (which means we have bottle as barrier), i want that the cycle continues to work like before (so both motor works like at the beginning). IF SOMEONE CAN HELP PLEASE HELP.projekt_miha_v2.xodball (17.1 KB)

It would help if you specified what IS happening rather than just implying it doesn’t work. My guess is that the stepper motor does not continue to turn until a bottle is in place. There are two issues with this. One is that you compare sensor value to greater than 0.2 and less than 0.1; nothing happens if the sensor ever falls between these values. The other is that you are sending the “less” node boolean output to an “any” node, which implies a pulse. It will only pulse when “less” switches from false to true; you need it to continue to pulse as long as less is true. A better solution would probably to replace the “gate” node connected to the “greater” node with a “branch” node. If “greater” is true, send pulse to animation-segment; else send it back to stepper-motor. The “less” node is not needed if you use “branch” instead of “gate”. (You still want to use the “gate” connected to flip-flop; you want that pulse to die and cycle to stop if flip-flop is false.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.