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

How To Declaration Of Multiple Variables.

hi,
im modifying one of the ARC examples for custom object avoidance 2. my robot is avoiding most obsticles right now. but when he gets boxed in I just want it to backup when it detects the left,right, center at 255.
I tried this

Code:

if($PingL,$PingR,$PingC < $MinDist)
Goto(AllBad)
endif

how can I do this?




here is the code

Code:

# Set the servo left position
$PosL = 20

# Set the servo center position
$PosC = 50

# Set the servo right position
$PosR = 80

# Set the mininum distance
$MinDist = 60

# Begin moving
Forward()
PWM(d19,35)


:Loop

# Scan left
Servo(d3, $PosL)
Sleep(150)
$PingL = GetPing(d4, d5)
if ($PingL < $MinDist)
Goto(LeftBad)
endif


# Scan Center
Servo(d3, $PosC)
Sleep(150)
$PingC = GetPing(d4, d5)
if ($PingC < $MinDist)
Goto(CenterBad)
endif

# Scan Right
Servo(d3, $PosR)
Sleep(150)
$PingR = GetPing(d4, d5)
if ($PingR < $MinDist)
Goto(RightBad)
endif


# Scan Center again
Servo(d3, $PosC)
Sleep(150)
$PingC = GetPing(d4, d5)
if ($PingC < $MinDist)
Goto(CenterBad)
endif


Goto(Loop)
:AllBad
Reverse(100,1000)
Right(100,960)


:LeftBad
Right(100, 960)
Forward(100)
Return()

:CenterBad
right(100, 960)
Forward(100)
Return()

:RightBad
Left(100, 960)
Forward(100)

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.
United Kingdom
#1  
If conditions can include and and or;

Code:


If($PingR < $MinDist and $PingL < $MinDist)
Goto(AllBad)
EndIf


or for 3

Code:


If($PingR < $MinDist and $PingL < $MinDist and $PingC < $MinDist)
Goto(AllBad)
EndIf
#2  
ok I see, thanks


works good now, thank you!
#3  
Hey Guys well for deceleration multiple variables must visit that url:

scala> val x, y, z = 1
x: Int = 1
y: Int = 1
z: Int = 1
PRO
Synthiam
#4  
@markspend01, sorry. I'm unsure what your post means. Is it a question or a statement? Please elaborate...