Page 44Writing an iRobot Create ScriptThe iRobot Create Open Interface is described in a guide made available via the web(http://www.irobot.com/filelibrary/pdfs/hrd/create/Create%20Open%20Interface_v2.pdf). Amongother things, the guide describes the serial byte codes used to govern the behavior of the iRobot Createmodule.The KIPR Link communicates with the iRobot Create via a (TTL) serial connection. Functions are includedin the KIPR Link Library for the iRobot Create, and send serial byte code sequences to the Create overthe serial connection, making it possible to operate the Create without having to reference the OpenInterface guide. These sequences cover the large majority of actions users typically want to haveperformed by a Create module (e.g., drive forward at a given speed, determine how far the Create hastravelled, etc). They also provide a means for the KIPR Link to directly control an iRobot Create.The Open Interface also provides for scripts, where a script is a (limited) sequence of iRobot Create bytecode commands ordered to perform some set of actions independent of external control. In contrast toother commands, a command to start a script disables serial communications until the script hasfinished.The iRobot Create has several built in scripts, mostly to serve the needs of its cousin, the iRobotRoomba. The Open Interface provides byte code commands for running these. It also has a byte codecommand for loading a user defined script onto the iRobot Create along with a byte code command tostart it running. The user defined script remains available until the iRobot Create is power cycled.Unlike high level languages, scripts for the iRobot Create have no provision for flow of controlcommands such as if and while, but can use commands to wait for an elapsed time, or for a specifieddistance or angle to be reached, or for an event such as a bump (wait commands are not availableexcept within scripts).Memory for storing a user defined script is limited to 100 bytes.The create_write_byte function in the KIPR Link Library is used for defining and sending a script (byte bybyte) to the iRobot Create. The KIPR Link Library provides 3 commands for serial communicationsbetween the KIPR Link and an iRobot Create.create_read_block(<data string>, <count>)The Create sends the number of bytes specified into the data string.create_write_byte (<byte>)The KIPR Link send the specified byte to the iRobot Create.create_clear_serial_buffer()The internal serial buffer is emptied of any unaccessed send/receive data.