Asked — Edited
Resolved Resolved by Rich!

If-Then Programming

Can anyone give me info on how to program an If-Then sequence? Ex. If the robot sees a red ball, it will stop, if it sees a green one, it will go forward. Also a screenshot of the programming would be helpful. Thanks!


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

United Kingdom
#1  

I have covered IF statements in a few topics, I'll list them in a sec. But to answer this question is very simple;

First you need to make sure you have the camera control set up for colour detection, this will give ARC the global variable called $CameraObjectColor

Then your script would need the following IF statement


IF($CameraObjectColor = "Red")
  Stop()
ELSEIF($CameraObjectColor = "Green")
  Forward()
ELSE
  # Neither colour detected
  Print("No colour detected, awaiting colour to proceed")
EndIf

PRO
Synthiam
#4  

There are dozens of example projects in ARC that demonstrates everything.

  1. Start ARC

  2. Press OPEN file the FILE menu

  3. Press the EXAMPLES button

You will now see sub directories for SCRIPT examples and FUNCTION examples

United Kingdom
#5  

I still keep forgetting about the examples already in ARC, must remember next time:)

#6  

Thanks for the help! I am excited to test it out!