Magnetic sensor cannot read (_MGD) and (_MGT) commands

3 weeks 6 hours ago #29535252 by shirofizz
I'm am trying to use MGS1600GY to read a 25mm magnetic track and my code could not read (_MGD) and (_MGT) commands. The following is my code that I wrote.

option explicit
dim tapepos as integer
dim tapedetect as integer
dim throttle as integer
dim steering as integer
dim gain as integer
gain = 15
top:
wait(10)
tapepos=getvalue(_mgt)
tapedetect=getvalue(_mgd)
tapepos = tapepos/120
if (tapedetect=1)
throttle=150
else
throttle=0
end if
steering = tapepos* gain
setcommand(_g,1,throttle)
setcommand(_g,2,steering)
print("\r,"tape detect ", tapedetect,"\t","tape position ",tapepos,"\t","throttle ",throttle,"\t",steering)
goto top

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

Time to create page: 0.136 seconds