Can you use and's and or's when you are wrting a script?
I.E. if(d2=0) and if(getping => 30)
result i.e. forward()
I am trying to write a script but its seems a very long way of doing it if I have to type each if or else statment with the same result after each one. I mean i have a bunch of IF's that will result in the same action like stop(). I am just wondering if there is a way to write it like
IF() or IF() or IF() or IF()
or do I HAVE to write it like.
I am just used to writing industrial plc code the first 2 ways and wonding if it can be done in EZ-Script?
Thank you for any help.
Upgrade to ARC Pro
Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro
If (Value Condition Value )
- IF condition can support multiple comparisons and functions.
- See the Functions section of this document.
- Condition can be =, , =, , AND, OR
Example: If (GetDigital(D0) = 1)
Example: If ($Day = 2 AND $Hour = 3)
Example: If (GetServo(D5) >20 OR ($x >= 3 and $y < 2))
But I missed something again.
# This the main forward script
# this will get the ping data and
# and put it into a variable
$MAIN_PING = GetPing(d0,d0)
$LEFT_PING = GetPing(d1,d1)
$RIGHT_PING = GetPing(d2,d2)
#Using the Sharp sensor for edge detection and
#put the data into a variable
$FRONT_EDGE = GetADC(adc3)
If($MAIN_PING 41 or $LEFT_PING > 41 or $RIGHT_PING > 41 or $FRONT_EDGE > 41)
when I run this script it runs through the ifs at least it looks like right but it solves the first if and stops the bot then loops around again and starts the bot forward then solves the first if again and stop it again. It just keeps doing that.
Now what I am trying to do is for it to stop only when the first if is solved, but it seems like it looks at the if and then just runs the stop. What am I missing to tie that stop command to the if statement.