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


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

#9  

write a script that has two servos moving at once. Then call on that script to start/end.

Australia
#10  

But I need a code to write that will operate two servos at the same time, not one after the other. Or perhaps I am just mis-understanding you. I am new to this so could you please explain it in a relatively simple way.

#11  

if you write a script like:

servo(d0, 28) servo(d1, 28) sleep(1000) servo(d0, 4) servo(d1, 4) sleep(1000)

This will move servos (d0 and d1) at the same time to the respective positions. Since there is no sleep command between the two servos they will move at the same time.

But remember, you need to have a sleep command between movements of the same servo. Or the servo can't resolve between the two commands. It'll just shake and not move fully.

Even though the servo's are commanded to move at the same time, the servos may not move identically because of electronic differences between the two.

Hope this helps.

EDIT: A word of caution, normal sized servo's require about an amp a piece so you need an appropriate power supply that can supply enough current to move multiple servos at the same time without browning out.

Australia
#12  

Thanks for that, I get you now.

Australia
#13  

Hello Again I need a line of code for ARC which will start a script or something similar when the camera detects movement. Is this possible? It would be a great help to me.

PRO
Synthiam
#14  

You sure can...

  1. Create a script control with all your stuff
  2. Name the script control "Test Script"
  3. Then in the "camera found" of Config in the Camera Control, enter this

ControlCommand("Test Script", ScriptStart)

Australia
#15  

Thanks. That will be really helpful for my project.

Australia
#16  

I can't seem to find the "Camera Found" in the Camera window. There is "Colour Found Script" and "Colour Lost". Is the "Colour Found Script" the same as "Motion Found?"

Also I have been having trouble installing the latest ARC. At the top of the ARC window it reads Version 2011.08.10.00. When I click on the "Check for Latest Version" in the Utilities drop box it says that the newer version is available. But when it comes round to installing it a message pops up saying that a newer version is already installed.