Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Asked — Edited

Motor And Potentiometer Script Help

I had this script working in ez builder with only one board. I added a second board and added a 1. to the beginning of each command in the scripts but now I cant get the ports to turn of or on.

I also get Syntax errors after I've run the scrip a few times and (I dont think) I made any changes.

I also added the .1 in the call scripts "move right" and "move left". Please see each below and let me know what I'm doing wrong:

#Main script:

# This script will move an HBridge to
# the specified ADC value.

1.if ($adcSpecified = 0)
goto(Error)

:Start

1.$adcCurrent = GetADC(adc0)

1.if ($adcCurrent $adcSpecified)
goto(RotateRight)

1.if ($adcCurrent = $adcSpecified)
goto(RotateStop)

goto(Start)

:RotateLeft
1.Set(d1, on)
1.Set(d0, off)
Return()

:RotateRight
1.Set(d1, off)
1.Set(d0, on)
Return()

:RotateStop
1.Set(d1, off)
1.Set(d0, off)
Halt()

:Error
Say("There is no specified position to move too")
------------------------------

#Move Right Script:

# This script will move the motor into the
# right position

1.$adcSpecified = 150
ControlCommand("Hips", scriptStart)

-------------------------------

#Move Left Script:

# This script will move the motor into the
# left position

1.$adcSpecified = 50
ControlCommand("Hips", scriptStart)

Any help is welcomed.
Thanks, Dave Schulpius

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
#1  
Do I have to have both boards powered up and connected to make my new script work on the second board (first board shown as 0 and the second shown as 1 in the connect panel)? I only have the soecond board powered up.
#2  
OK, I have at least one D ports now working with the script. I added a "Set" control for the two ports I'm useing on the second board and confirmed that they are turning on and off with a volt meter. I've also found how to get by the Sytanx Error I go the call scripts and save each. That way I can go into the main script and make changes and save.

I've played with the script and have it turning on at least one of the Digital ports when I start the call scripts. However when I turn the pot the Varible Watch panel showing the "$adccurrent" does not change. It's stays on 1.0. I think this means it's not reading the ADC port of the second board. I still have sonething wrong with the main script. Here's the script as it is now (any help is welcomed):

# This script will move an HBridge to
# the specified ADC value.

if ($adcSpecified = 0)
goto(Error)

:Start

$adcCurrent = 1.GetADC(adc0)

if ($adcCurrent $adcSpecified)
goto(RotateRight)

if ($adcCurrent = $adcSpecified)
goto(RotateStop)

goto(Start)

:RotateLeft
1.Set(d1, on)
1.Set(d0, off)
Return()

:RotateRight
1.Set(d1, off)
1.Set(d0, on)
Return()

:RotateStop
1.Set(d1, off)
1.Set(d0, off)
Halt()

:Error
Say("There is no specified position to move too")