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

Canada
Asked — Edited

Script Command Manual

Functions

Sleep (milliseconds)
Pauses for specified milliseconds
Example: Sleep(1000)

SleepRandom (lowMilliSec, highMilliSec)
Pauses for a random millisecond delay between the 2 provided values
Example: SleepRandom(1000, 5000)

Servo (servoPort, position)
Move servo to the specified position
Example: Servo(D14, 25)

ServoUp (servoPort, count)
Increment the servo position value up by specified count
Example: Servo(D14, 1)

ServoDown (servoPort, count)
Decrement the servo position value by specified count
Example: Servo(D14, 1)

ServoRandom (servoPort, lowPosition, highPosition)
Move the servo to a random position between low and high
Example: Servo(D14, 10, 20)

Release (servoPort)
Release a servo from holding its position
Example: Release(D14)

Move (servoPort, [forward/stop/reverse])
Set a modified servo to move
Example: Move(D14, FORWARD)

Set (digitalPort, [on/off/true/false])
Set a digital port state to either on or off
Example: Set(D2, OFF)

ToggleDigital (digitalPort )
Toggle the digital port

Digital_Wait (digitalPort, [on/off/true/false])
Wait until the digital port status has changed
Example: Digital_Wait(D12, ON)

ADC_Wait (adcPort, [higher/lower/equals], value)
Wait until ADC port is higher or lower than specified value
Example: ADC_Wait(ADC0, HIGHER, 50)

Movement_Wait ([forward/reverse/stop/left/right])
Wait until a movement from the Movement Panel is specified.
Even if another script executes a movement, this will execute
Example: Movement_Wait(FORWARD)

Servo_Wait (digitalPort, [higher/lower/equals], value)
Wait until the servo Port is higher or lower than specified value.
Zero can be specified as a value for a stopped servo.
Example: Servo_Wait(D5, HIGHER, 20)

WaitForServoMove (servoPort)
Waits for the specified servo to move.
Unlike Servo_Wait, this function does not wait for a specific value. It simply returns once the servo has moved to a new position.
Example: WaitForServoMove(d0)

Ping_Wait (triggerPort, echoPort, [higher/lower/equals], inches)
Wait until the Ping Sensor distance is higher or lower than specified value in inches.
Trigger and Echo are Digital Ports
Example: Ping_Wait(D3, D4, HIGHER, 50)

Forward( [fastest/fast/slow/slowest] )
Using the servo port settings from a Movement Panel Control, this will start your robot in the Forward direction.
Optionally, you can provide the speed or leave the parameter empty.
You will require at least one Movement Panel to be configured within the project. This function will control that movement panel.

Reverse( [fastest/fast/slow/slowest] )
Using the servo port settings from a Movement Panel Control, this will start your robot in the Reverse direction.
Optionally, you can provide the speed or leave the parameter empty.
You will require at least one Movement Panel to be configured within the project. This function will control that movement panel.

Stop()
Using the servo port settings from a Movement Panel Control, this will stop your robot.
You will require at least one Movement Panel to be configured within the project. This function will control that movement panel.

Left( [milliSeconds] )
Using the servo port settings from a Movement Panel Control, this will turn your robot left.
You will require at least one Movement Panel to be configured within the project. This function will control that movement panel.
Optionally, you can specify the number of milliseconds to turn.
Example #1: Left()
Example #2: Left(200)

Right( [milliSeconds] )
Using the servo port settings from a Movement Panel Control, this will turn your robot right.
You will require at least one Movement Panel to be configured within the project. This function will control that movement panel.
Optionally, you can specify the number of milliseconds to turn.
Example #1: Right()
Example #2: Right(200)

Sound_Random( digitalPort, noteLength, noteCount)
Plays a little random melody out of the EZ-B speaker that is on the specified digitalPort. Note length is in MS, and noteCount is the number of notes to play.

Sound_Note( digitalPort, noteLength, note)
Plays a note out of the speaker that is on the specified digitalPort. Note length is in MS, and note is the number of note to play.

Say( text to speech )
Speaks the text that is specified within the brackets out of the PC Sound Card.

SendI2C( hexAddress, data, .... )
Send a series of data to the specified hex address over the I2C interface
Data can be Hex (0x09), character ('c'), string ("string"), or decimal (188)
Example: SendI2C(0x09, 'n', 0x00, 0x50, 244, "This is text")

SendSerial( digitalPort, baudRate, data, ... )
Send a series of data over the specified port and baud rate
Data can be Hex (0x09), character ('c'), string ("string"), or decimal (188)
Example: SendI2C(0x09, 'n', 0x00, 244, "This is text")

WaitUntilTime( hour, minute )
Pauses until the specified time. To be cpu friendly, the accuracy is within the minute of the specified time. It will trigger within the minute, just not on the minute.
Example: WaitUntilTime(17, 30)

MP3TriggerPlayTrack( digitalPort, baud, trackNumber )
Plays the specified MP3 track from the MP3 Trigger Sheild
Example: MP3TriggerPlayTrack( d0, 38400, 1 )

MP3TriggerPlayRandomTrack( digitalPort, baud, lowestTrackNum, highestTrackNum )
Plays a random MP3 track from the MP3 Trigger Sheild between the supplied track numbers
Example: MP3TriggerPlayTrack( d0, 38400, 1, 10 )

MP3TriggerNext( digitalPort, baud )
Plays the next MP3 track from the MP3 Trigger Sheild
Example: MP3TriggerPlayNext( d0, 38400 )

MP3TriggerPrev( digitalPort, baud )
Plays the previous MP3 track from the MP3 Trigger Sheild
Example: MP3TriggerPrevious( d0, 38400 )

MP3TriggerStop( digitalPort, baud )
Stops the current MP3 track from the MP3 Trigger Sheild
Starts the mp3 file if not playing
Example: MP3TriggerStop( d0, 38400 )

ControlCommand( windowName, windowControlCommand )
Sends a command to the window by its name
Example: ControlCommand( "ADC Graph", pause )

# Commented Text
Comment a line of code

:Label
Defines a label for a GOTO() command
Example: :My_Label

Goto( label )
Goto a specific :Label location
Example: Goto(My_Label)

If ( servo [Port] [Condition] [Value] )
Queries a servo Port for its position against your condition.
Port is a servo Port (between d0 and d20)
Condition is either =, , =,
Value is an user defined integer
If true, the following command (next line) is executed
If false, the following command (next line) is skipped
Example: If (Servo D0 > 5)

If ( ADC [Port] [Condition] [Value] )
Queries an ADC Port for its value against your condition.
Port is an ADC Port (between adc0 and adc7)
Condition is either =, , =,
Value is an user defined integer
If true, the following command (next line) is executed
If false, the following command (next line) is skipped
Example: If (ADC ADC2 > 50)

If ( Digital [Port] [Condition] [Value] )
Queries a Digital Port for its state against your condition.
Port is a Digital Port (between d0 and d20)
Condition is either =,
Value is either True or False
If true, the following command (next line) is executed
If false, the following command (next line) is skipped
Example: If (Digital D0 false)




References

Multiple EZ-B Boards
EZ-Builder supports multiple physical EZ-B Boards connected to your computer. You can specify the board by putting the board number in front of the command. For example: 2.Servo(d0, 8) will move the D0 servo on EZ-B board #2 to position 8. If no board is specified, the first board (zero) is assumed. If using more than one board, the first board is always responsible for movement panels.

ADC Ports
ADC0
ADC1
ADC2
ADC3
ADC4
ADC5
ADC6
ADC7
ADC8

Servo/Digital/Uart Ports
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
D10
D11
D12
D13
D14
D15
D16
D17
D18
D19

Baud Rates
300
1200
2400
4800
9600
19200
38400
57600

Window Control Commands
All Controls
PauseOn
PauseOff
PauseToggle

Camera Device
CameraServoTrackEnable
CameraServoTrackDisable
CameraServoTrackToggle
CameraMovementTrackEnable
CameraMovementTrackDisable
CameraMovementTrackToggle

Camera Device Tracking Modes
CameraColorTracking
CameraMotionTracking
CameraView
CameraFaceTracking
CameraAutoTracking

Camera Snapshot
CameraSnapshot

Scripting
ScriptStart
ScriptStop

Personality Generator
RunOnce

Sound Board
Track_0 ... Track_9


Music Notes
C1
Db1
D1
Eb1
E1
F1
Gb1
G1
Ab1
A1
Bb1
B1
C2
Db2
D2
Eb2
E2
F2
Gb2
G2
Ab2
A2
Bb2

Synthiam
#23  
You can do that, or the checkbox that says "Repeat"
Australia
#28  
Could you give us a table containing different speeds matched to the values for the ServoSpeed command. I am not sure what is slow and what is fast. Also, what is the standard speed for servos?
Synthiam
#29  
Oh man i forgot! The servo speed command is accepted but it doesn't do anything right now. I was having huge timing issues with the 20 servo PID's. I'm working on a new servo speed that won't affect timing for other devices. It's on the list too.

And your motion thing is up next btw
Australia
#30  
Thanks. I can't wait. The servo speed has become useful for me now because of the scan scripts I have added. There are three: Scan Left, Scan Right and Scan. The Scan Right rotates the servo slowly to the right on a horizontal axis, the Scan Left rotates the servo slowly to the left on a horizontal axis and the Scan continues to scan back and forth. All of the three scripts stop and the servos return to their original speed when I release the corresponding joystick button. I plan to add a fourth Continuous Scan script which continues to scan even when I release the button. Is there any command which acts as a toggle for starting and stopping scripts? I thought the scripts would be a cool addition and would give the horizontal servo a smooth slow rotation speed, one that I am be unable to achieve with the joystick. I think I am past the major programming stage for my camera. I am simply adding some new features and fixing any mistakes. The building of the security camera is incredibly simple, allowing me to focus on the programming. Sadly I lack the most important part of the whole project, the camera. But don't worry, I am definitely going to buy it from you
Synthiam
#31  
If a script is set to repeat, then you can scriptStart and scriptStop

Do you want a "toggle/on/off for the repeat" option?
Australia
#33  
Could you also make a start/stop script toggle or something similar, if that is possible
Australia
#34  
I have decided to merge the Continuous Scan Script and Scan Script. The Scan Script will repeat instead of stopping when I release the button. I have replaced the Continuous Scan Script button with a Scan Stop Script. This will allow me to stop and start the scan at will But please still include a toggle on/off for the repeat function. I think that will be very useful in future projects, for all of us
Australia
#35  
I can't seem to get the Move(servo port, [forward, stop, reverse]) to work. I type in Move(D3, Forward), attempt to save and the syntax error message appears. The command I gave is nearly identical to the example
#36  
Do i need a script, or movement script at the same time i use a modified servo Movement Panel to send a command to a motor controller?
the motor controller is sabertooth 2x25 and it only has 2 inputs (for controlling 2 motors), it has Signal 1 and Signal 2.
i can not get my ez-b to communicate with the motor controller.
Synthiam
#37  
1) Setup your controller as RC mode.

2) Connect the 2 RC pins from the controller to 2 I/O pins of the EZ-B. The I/O pins are not labeled GND or +5. It is the furthest pin out. Make sure it's Digital, not ADC. Check the manual. Digital pins start with a D

3) Add a Modified servo panel.

4) Press CONFIG

5) Select the two ports you connected the SAbertooth controller to

6) Use the directional arrows to drive your robot

If that doesn't work, your sabertooth isn't configured correctly. Contact their support for assistance on their product and why RC mode doesn't work.
#38  
Hi guys,

I was wondering if there is any way to get the script editor to accept math functions? I'm trying to set up a proper analogue system with potentiometers in place of the Joystick option, but it seems the only way to get it to work is to hard set the values on the ADC, so if the ADC = 10 the servo = 1, if the ADC = 20 the servo = 2, and so on.

Naturally, to get a full servo sweep, this creates a huge amount of code to run every frame and takes about 0.2 seconds to complete the evaluations for a full servo sweep. And this latency leads to the evaluation missing the mark, so the servo position fails to update, unless the the evaluation frame just happens to fall on the exact analogue value of 10 or 20, etc...

What I was hoping for was a way to write an equation that automatically reads the position of the ADC and calculates the servo position accordingly, without having to hard code it. This way, if I'm creating an analogue control system (like a glove or armateur) I'm not forced to destroy a perfectly good USB controller, and I can make my ranges a lot more dynamic.

Any thoughts?
Synthiam
#39  
Currently the scripting engine does not support variables or math functions. I expected the EZ-SDK for people who wanted that kind of control. It seems the ARC is growing into a development environment. And since then, there are math and variables on the TO-DO list for the future.
#40  
it would a super good add-ons to have variables an math funtions that is about what i am looking for the sonar sensor,plus be really good for analog too,there so many needs for it
hope very soon DJ:D
Synthiam
#41  
Add Control -> Script -> VB

or

Add Control -> Script -> C#

The VB is very easy to use:)
#42  
@DJ Sures
Regarding your Post on 5/7/2012:

Is there supposed to be specific controls for VB and C#, With in ARC?
Does the Add control -> Scripting -> EZ-Script accept VB/C#?

Not sure what you mean by the post...