Script Commands
The following commands let you specify a script for iRobot Create
to play at a later time.
Script
Opcode: 15
This command specifies a script to be played later. A script
consists of OI commands and can be up to 100 bytes long.
There is no flow control, but "wait" commands (see below)
cause Create to hold its current state until the specified
event is detected.
• Serial sequence: [152] [Script Length] [Opcode 1]
[Opcode 2] [Opcode 3] etc.
• Available in modes: Passive, Safe, or Full
• Changes mode to: No Change
• Script data byte 1: Script Length (0 – 100)
Specifies the length of the script in terms of the
number of commands. Specify a length of 0 to clear
the current script.
• Script data bytes 2 and above: Open Interface commands
and data bytes
Tip: To make a script loop forever, use Play Script (153) as
the last command.
Example Scripts:
Drive 40 cm and stop:
152 13 137 1 44 128 0 156 1 144 137 0 0 0 0
Toggle led on bump:
152 17 158 5 158 251 139 2 0 0 158 5 158 251 139 0
0 0 153
Drive in a square:
152 17 137 1 44 128 0 156 1 144 137 1 44 0 1 157
0 90 153
iRobot Create Open Interface (OI) Specification
Play Script
This command loads a previously defined OI script into the
serial input queue for playback.
• Serial sequence: [153]
Data Bytes: N + 1
• Available in modes: Passive, Safe, or Full
where N is the number
• Changes mode to: No Change
of bytes in the script.
Show Script
This command returns the values of a previously stored
script, starting with the number of bytes in the script and
followed by the script's commands and data bytes. It first
halts the sensor stream, if one has been started with a
Stream or Pause/Resume Stream command. To restart the
stream, send Pause/Resume Stream (opcode 150).
• Serial sequence: [154]
• Available in modes: Passive, Safe, or Full
• Changes mode to: No Change
Wait Commands
The following commands cause Create to wait for a specific
time, distance, angle of rotation, or event to occur. While
it is waiting, Create does not change its state, nor does it
react to any inputs, serial or otherwise. These commands
are intended for use in scripting only.
Wait Time
This command causes Create to wait for the specified time.
During this time, Create's state does not change, nor does
it react to any inputs, serial or otherwise.
• Serial sequence: [155] [time]
• Available in modes: Passive, Safe, or Full
• Changes mode to: No Change
• Wait Time data byte 1: Time (0 - 255)
Specifies time to wait in tenths of a second with a resolution
of 15 ms.
Opcode: 153
Data Bytes: 0
Opcode: 154
Data Bytes: 0
Opcode: 155
Data Bytes: 1
15
Need help?
Do you have a question about the CREATE - OPEN INTERFACE and is the answer not in the manual?