How To Declaration Of Multiple Variables.

 
#1

hi,
im modifying one of the EZ-Builder 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)

#2

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

#3

ok I see, thanks


works good now, thank you!

#4

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

#5

@markspend01, sorry. I'm unsure what your post means. Is it a question or a statement? Please elaborate...