Asked — Edited

New To Ez-Robot, Help, Getadc

I'm new to EZ robot. I have motors connected through a sabertooth 2x12A controller to my robotic joint and I have read back from a potentiometer for position. I can see the position on the graphic display and the digital voltage readout. Everything is working as expected. I then assume, that for me to control it they way that I have to, I need to write a script. I opened the EZ script and went to read the analog voltage using GetADC(0) and it responds during the syntax check that it is an unknown command. As you can probably tell I'm lost, could someone help steer me in the right direction? Thanks


ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

United Kingdom
#1  

You were almost right.

Quote:

GetADC( Port ) Returns the ADC value of the specified port

Example:

$value = GetADC(ADC0)

The EZ-Script manual is on the right of the EZ-Script control and gives information on all commands including examples.

Also, I would suggest reading through my An Introduction To Scripting post. it covers GetADC.

#2  

I'll check it out. Thanks!

PRO
Synthiam
#3  

Also, a good person to ask is @dschulpius who made the Lost In Space b9. He did the same thing. He made his own giant servo with a motor and potentiomememememeter

#4  

I'm losing my mind. The thing that scares me about all this stuff is the programming. So today is really getting to me. It's the littlest things that keep me from progressing. Her's where I am getting hung up I am trying to do : in my If (GetADC(0) > 155) works great, but if I try replacing the GetADC(0) with a variable like $position like this If ($position > 155) it just does not work. I am probably doing something really stupid, help.

United Kingdom
#5  

Honestly, if you read through my Introduction To Scripting post (I know it's long but it's worth it) you will learn about GetADC, variables etc.

The short answer though is a variable, such as $position needs to be defined.


$position = GetADC(ADC0)
IF($position > 155)
  # Do whatever you need it to do
ENDIF

#6  

Thank Rich, I did read your Introduction To scripting, I think it's great and plan on reading a few more times. I'm just trying to get my new EZ board going, and rushing. I was using another brand of controller board but gave up due to the complexity. I don't think that I will hit that point with EZ robot, it's everything I was looking for. Thanks again for the help.