Asked — Edited

Servo (Stop) / Servo Stop - How To Stop A Servo At A Specific Adc Value

Hello,

i have one ( i hope easy) question.

i have a pressure sensor.

Work fine on the ADC!

Now i have one problem.

If the value for the ADC port is under 180 the servo must stop ( hold his position)

my idea of a script :


:loop
$CurrVoltage = GetADC(ADC0) 
if ($CurrVoltage <= 180)
servo (d0, "stop")
sleep(300)
endif
goto (loop)

But the command servo (d0, "stop") dont exist

So with command i can take what tells the servo he must stop and HOLD his position.

Thanx a lot for helping

AND FOR ALL A HAPPY NEW YEAR!

AND BIGGER ROBOTS NEXT YEAR!


ARC Pro

Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

#17  

Hi Richard!

Happy new year!

How i slow down the servo in DJ´s Script?


repeat ($pos, 180, 0, 15 )
  servo(d0, $pos)

  if (GetADC(adc0) &lt;= 75) or (GetADC(adc1) &lt;= 175)
  
    halt()
    
  endif
sleep(50)


endrepeat

#18  

@Boris... Could you use the release command and a slow moving servo .... although releasing a servo means resetting servo speeds again.....


servospeed(D0,3) # slowly close hand... lower is faster, higher is slower
  servo(d0, $pos)
:top
  if (GetADC(adc0) &lt;= 75) or (GetADC(adc1) &lt;= 175)
  
  release(D0)
    halt()
  endif
sleep(50)
goto(Top)

#19  

Hello Richard!

And from where the Servo/the variable knows to move to which position?

($pos, 180, 0, 15 )

Boris

EDIT:

Or work your script like a monitoring script (i am not near my Inmoov)

#20  

@Boris.... You give $pos any value you want for example...


$pos = 30 #closed finger

servospeed(D0,3) # slowly close hand... lower is faster, higher is slower
  servo(d0, $pos)
:top
  if (GetADC(adc0) &lt;= 75) or (GetADC(adc1) &lt;= 175)
  
  release(D0)
    halt()
  endif
sleep(50)
goto(Top)

#21  

Hi Richard,

i understand now!

I will try in 2-3 hours, then i am back!

Boris

PS. And then i tell you if it works!

#22  

Hello Richard,

sorry it not works. If the value for the ADC is under the servo release not HOLD the Position! So this means if the Hand will hold something it will fall down.

The servo must hold his postions!

The best way until now is still the way from DJ!

Boris

PRO
Synthiam
#23  

Boris, no one can give you the complete solution catered to your application. We can only lend a hand and provide the template for you to work from. It's up to you to learn from the examples we provide. Keep at it and it'll come together for you:)

#24  

Hello DJ!

Everything OK! I never was thinking to get a completer Robot!

Thats why i am asking! Do you know "Sesame Street"? Who not ask, will stay stupid!

Again Everything ok, you understand something wrong! Relax!

Boris