Digital input flickering when running the script on MDC2460

4 years 1 month ago #29534549 by tanay
Hello guys,
Recently I encountered a problem which I am not able to solve,
I am making an AGV with MDC 2460 using array of five IR sensors
with follows a black line.
As my 5 digital inputs are hooked up by IR sensor, I am left wiyh one digital input which i used for obstacle avoidance ,
how - I took arduino and connect ultrasonic to it
powered the 5v for the arduino with controller 5v out
when the ultrasonic sensor detects the obstacles the arduino make one of its digital input high and that goes in to the roboteq digital input 6
but now the problem is why it is flickering when i click the run script button. When I pause the script it works fine.
I don't know Why is this happening
here is the code
.
.
.
.
**************************************************
'1 means white
0 means black


dim s1 as integer
dim s2 as integer
dim s3 as integer
dim s4 as integer
dim s5 as integer
dim s6 as integer


agv:


s1= getvalue(_di,1)
s2= getvalue(_di,2)
s3= getvalue(_di,3)
s4= getvalue(_di,4)
s5= getvalue(_di,5)
s6= getvalue(_di,6)


if(s3=0) 'forward center
setcommand(_g,1,400)
setcommand(_g,2,400)

else if(s2=0) 'slight left
setcommand(_g,1,400)
setcommand(_g,1,320)

else if(s4=0) 'slight right
setcommand(_g,1,320)
setcommand(_g,1,400)

else if(s1=0)
setcommand(_g,1,500)
setcommand(_g,1,100)

else if(s5=0)
setcommand(_g,1,100)
setcommand(_g,1,500)

else if(s6=0) ' obstacles sensor 0 means high
setcommand(_g,1,0)
setcommand(_g,1,0)

else if(s1=s2=s3=s4=s5=1) ' agv is out of line
setcommand(_g,1,0)
setcommand(_g,1,0)

end if
goto agv

Please Log in or Create an account to join the conversation.

4 years 1 month ago #29534553 by Gabriel_Isko
You will have to check the voltage level at your digital input and ensure that it isn't floating. You should post your wiring schematic.

I would also recommend taking a look at our MGS1600GY sensor and magnetic tape, which is designed to integrate with our motor controllers. We even include a section about it in our User Manual .

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.055 seconds