Introduction

Welcome to the help page for the Ohbot app.

To bring your Ohbot or Picoh to life you need to give it instructions. Instructions are written using blocks that do different things. There are blocks to help move your robot's motors, speak, use sensors and inputs and play sounds. There are also blocks that let you do things like looping and adding and subracting numbers. Blocks can be combined to form a sequence. We call one or more sequences of instructions a "program".


The blocks in a sequence in an program run one after another in order from the top of the sequence.

Your job as a robot programmer is to combine different blocks to make your robot do different things.

Environment

This is the Ohbot app programming environment.

Motion

Ohbot has 7 Motors. Picoh has 3 motors and an LED matrix which provides 3 eye movements that work in the same way as motors. You can control each motor movement separately. Each motor has a position which is set to a value between 0 and 10. You can either change or set the position of a motor using a block. You can use:

set

There's one of these blocks for each motor. Set the position of a motor to a number between 0 and 10 by typing into the box, selecting it from the dropdown list, or by dragging a Sensing, Data or Operator block into this box (see below). You can change the motor that's being set by clicking on the motor name and selecting from the list of available motors.


For Picoh, the blocks that set pupil or eyelid positions on the matrix allow you to change whether you want to change the left, right or both eyes. This allows you to make Picoh wink or go cross-eyed.

change

This block allows you to change the position of a motor by a number between 0.1 and 10. You can also change by negative numbers between -0.1 and -10.

set motor speed

This block allows you to set the speed of a motor to a number between 0 and 10.

Here's some code to try out:

set eyes to/set base to

If your Ohbot has Illumineyes you can use this block to set the colour of the eyes. For Picoh it will set the colour of the base. Click on "red" to show a list of the available colours.

set eyes/set base

If your Ohbot has Illumineyes you can use this block to set the red, green or blue of the colour of the eyes. For Picoh it does the same for the base. Click on "red" to select whether you want to change red, green or blue. Select a number between 0 and 10 into the second box.

change eyes/change base

If your Ohbot has Illumineyes you can use this block to change the red, green or blue of the colour of the eyes. For Picoh it does the same for the base. Click on "red" to select whether you want to change red, green or blue. Select a number between -10 and 10 into the second box to set the amount that you want to change the colour by.

Here's some code to try out. For Ohbot the blocks will be called "eyes" instead of "base":

Make an Eyeshape

Picoh only. Click on this block to create a new eyeshape in the EyeShape Designer.

set eyeshape

Picoh only. Use this block within a program to set the eye shape of Picoh's eyes. By default, both eyes are changed to the selected eyeshape but you can also change each eye to a different shape by selecting left or right from the dropdown.

Click on the icon at the right of the block to open the EyeShape Designer so that you can edit the eyeshape.

set eye brightness to

Picoh only. Use this block within a program to set the brightness of Picoh's eyes.

Events

A sequence in a program must always start with an event block.

when flag clicked

Use this block to start a sequence when the green flag button is clicked.  You can see the green flag on the panel just under the menus.  Clicking on the red button stops any programs that are running.  Clicking on the yellow button resets your robot.

when ______ clicked

This block starts a sequence when you press a key on your keyboard.  Click on "space" to show a list of the keys that you can use. You can use more than one of these blocks in one program so your robot does different things depending on which key is pressed.

When Word Heard

If you have a microphone connected to your computer you can use this block to start a sequence when your robot "hears" you say a certain word. The words that can be understood can be set from the Sensors screen on the Settings menu. Using a smaller vocabulary of words makes speech recognition more accurate.

New Message

Messages are used to pass information between different sequences of blocks within a program or to start one sequence from another.  If you have configured shared messages on a network you can also send messages between robots.

Use the New Message button to create a new message, be sure to name it something that will help you remember what it is used for. 

Select "Private" to use a message within a program. 

You can use a "Shared" message to send messages to another robot on a network.  Just set the shared message path in the Advanced menu to the same network path on both robots. 

You can use a "Pipe" message to send messages to another program on the same computer through a named pipe.  The pipe details need to be set up by editing the ohbot.exe.config file in the application folder. 

You can use a "Custom" message to send a message to a network path where the network path can be different for each message.  The shared path has to be typed in for each message on each robot for a custom message.

You can use a "Web" message to send a message across the web.  The unique name must match the Ohbot Unique name set on the Advanced menu of the person that you are communicating with. Web messages are experimental!

When Multiblock Clicked

This event block can only be used inside scripts that are used by a multiblock.  They are started when the button on the multiblock is clicked in the script that displays the multiblock.

When I Receive

This event block will start when the message you choose is received.  This is how you start one set of code from another set of code. Note that when i receive can be on a different program tab to the broadcast block that initiates it. If it's on several tabs then the one on the leftmost tab will be run.

when i receive will start if the message that's broadcast contains the message name. For example, if a message called "Play some music" is broadcast then a message called "music" will be started

Broadcast

Use this block to send out a message from within a sequence for a when I receive block to pick up.  If you put a variable or sensor block in the box that holds the message name any message that contains the value of the block will be run. For example, if you put an answer block and this contains "tell me a joke" then any message called joke will be run. If you put a value or a block in the box to the right of the message name this can be picked up by the sequence that receives the message in the message parameter sensing variable (see the Sensing section below).

Broadcast And Wait

Use this block to send out a message from within a program for a when i receive block to pick up and then wait until the program that's started by the when i receive block to finish before continuing.    If you put a variable or sensor block in the box that holds the message name any message that contains the value of the block will be run. For example, if you put an answer block and this contains "tell me a joke" then any message called joke will be run. If you put a value or a block in the box to the right of the message name this can be picked up by the sequence that receives the message in the message parameter sensing variable (see the Sensing section below).

Here's some code to try out:

Speech

These blocks are used to control your robot's speech.

say

Your robot will speak the words you type into the text box on the block. The next block in the sequence will run straight away without waiting for the speech to finish. You can stress a word by surrounding it with {} or you can play a sound from a wav file by surrounding it with <>. For example

In this example the word "really" will be stressed and the wav file yawn.wav will be played if it exists in the documents\music\ohbot folder.

The pitch, rate and volume used for a simple {} emphasis are pre-defined

You can also specifically set the pitch, rate and volume of an emphasis like this:

{pitch:rate:volume:text}

e.g. {x-high:fast:75:Hello}

There's more information about speech emphasis here but note that many of the options are not supported or are only supported by some voices.

Icons on the right of the block allow you to view the text in an immersive reader (if this is set up through Setup on the Cloud AI menu), dictate into the text block (if Speech Recognition and Cortana Dication are enabled through Sensors on the Settings Menu), or size the text box

say _____ until done

Your robot will speak the words you type into the text box on the block the same as the say block. The next block in the sequence will run once your robot has finished speaking. You can stress a word by surrounding it with {} or you can play a sound from a wav file by surrounding it with <>. See the say section above for more information about how a word is stressed.

Icons on the right of the block allow you to view the text in an immersive reader (if this is set up through Setup on the Cloud AI menu), dictate into the text block (if Speech Recognition and Cortana Dication are enabled through Sensors on the Settings Menu), or size the text box

say db

This block lets you speak text from a database.  The database is defined in a comma separated values (CSV) file in the folder Libraries\Documents\Ohbot which can be edited by clicking on the icon at the right of the block or by loading it into a spreadsheet program.  You can select which phrase from the database should be spoken by putting text or blocks into the two empty boxes on the block.

There's more information about speech databases in the technical notes section of the Ohbot Website.

Here's some code to try out:

set voice

This block lets you set what voice your robot will use for speech. For the latest information about how to install extra voices go to the Ohbot Technical Zone here and look at the Voices document in the Installation and Translation section. This setting will be applied to all speech until another of these blocks is used to reset the voice or until the reset button is used or a new program is loaded.

speech emphasis

This block lets you set the pitch, rate or volume of speech. The number needs to be between 0 (lowest for pitch, slowest for rate or quietest for volume) and 10 (highest for pitch, fastest for rate or loudest for volume). The default values for this are 5 for pitch and rate and 10 for volume. This setting will be applied to all speech until another of these blocks is used to reset the speech attribute or until the reset button is used or a new program is loaded.

stop all speech

This block stops speech even if it is in the middle of speaking.

Control

wait _ secs

Wait a number of seconds until moving onto the next block in the sequence. You can type the number of seconds in the text box.

There is an example of how to use a wait block in a program to make your robot blink in:
George's face tracking example program

wait until ____

Wait until a statement is true before moving onto the next block in the sequence.

These blocks will make your robot wait until the mouse is moved past the middle of the screen in the X axis

forever

This block repeats whatever is inside of it as long as the sequence remains running. There is an example of how to use a forever loop in:
George's face tracking example program

repeat _

Repeat the contents of the block a number of times.

These blocks will make your robot look left, wait a second, look right, wait 2 seconds. This sequence will be repeated 4 times.

repeat until

Repeat the contents of the block until a statment is true. Then move on.

These blocks will make your robot repeat the words "Is there anybody there?" Until the camera sees a face.

if ___ then

If a statment is true run the blocks inside the block once.

This sequence will make your robot say "The sun has got his hat on." if the weather input block is equal to 4 (which is the id for sunny) If the weather input block is not equal to 4 it will do nothing.

if ___ then...else

If a statment is true run the blocks inside the block once, if it is false run a different (else) set of blocks.

This sequence will make your robot say "The sun has got his hat on." if the weather input block is equal to 4 (which is the id for sunny) If weather input block is does not equal 4 your robot will say "It's not sunny today".

stop

Stop the program or sequence. You can choose from the dropdown list whether to stop all sequences in the program (all) or just the sequence that this block is in (this script).

load

Load a new program replacing the current program. No check is made for changes in the current program so use of this block can be destructive. For this reason this block is disabled unless it has been enabled in Advanced Settings

Sound

Your robot can play back any sounds stored in the documents\music\ohbot folder. You could try recording sounds like laughing or breathing and use these to help bring your robot to life. There are special blocks you can use to play and stop sounds inside your program.

play sound

Your robot will play whatever sound is chosen in the drop down menu. The next block will run straight away without waiting for the sound to finish.

play sound _____ until done

Your robot will play the sound you have chosen in the drop down menu on the block the same as the play sound block. The next block will run once the sound has finished playing.

play sound _____ looped

Your robot will play the sound you have chosen in the drop down menu on the block the same as the play sound block. It will loop until the program is stopped or the stop all sounds block is used.

set sound volume to

This block sets the volume of the sound that's playing or about to be played.

stop all sounds

This block stops any sounds that are playing in any sequence in the program.

Record a Sound

Click on this button to record a new sound with your microphone.

Sensing

The sensing blocks are used to get input from the outside world into your program.

Some of the blocks have a check box next to them, checking this box will display the block's current value at the top of the program widow.

You can also hover the mouse over a sensor block to see it's current value in the box at the bottom of the screen although this doesn't work for some of the more advanced blocks that require parameters.

Motor

This sensor block gives the position of the motor you have chosen from the list as a number between 0 and 10.

Eyes/Base Colour

If your Ohbot has Illumineyes this sensor block gives the red, green of blue value of Ohbot's current eye colour. For Picoh this sensor block gives the red, green of blue value of Picoh's current base colour.

MouseX

This sensor block gives the position of the mouse in the x axis as a number between 0 and 10.

MouseY

This sensor block gives the position of the mouse in the y axis as a number between 0 and 10.

Here's some code to try out:

This program will let you control the position of your robot using your mouse. Moving the mouse left or right (mouse x) will turn your robot's head and moving the mouse up and down (mouse y) will make your robot nod its head.

Key Press

This block gives a value of 1 if the key that's selected from the list is pressed or 0 if it isn't.

Ask And Wait

This block speaks what's in the text box and then waits for you to type a response.  The response is available in the answer block (see below).

Ask And Listen

This block speaks what's in the text box and then waits for you speak a response. The response is available in the answer block (see below).

This block works best if you have Cortana dictation turned on. Make sure that Cortana Dictation is enabled by selecting Sensors from the Settings menu.
You can select the language to recognize on this screen too. You can choose any language that's been installed for Windows.

Alternatively, you can also choose to enable Cloud AI services by purchasing Ohbot Credits (select Purchase on the Cloud AI menu) or by creating your own Microsoft Cognitive Services (select Setup on the Cloud AI menu).
You can select the language to recognize by selecting Cognitive Speech Locale on the Setup screen selected from the Cloud AI menu.

If Cortana dictation or Cloud AI Speech is available this block will use it else this block will use recognition running on your computer with a limited number of words.

Answer

This block holds the answer that was typed or spoken in response to an ask and wait or ask and listen block.

Here's some code to try out:

Last Word Heard

This block holds the last word that was spoken using local speech recognition. This block will only ever hold one of the words that you can see in the dropdown of the when word heard event block. These words are defined using the Sensor screen from the Settings menu.

To stop words from 'hanging over' from earlier this block is cleared by a repeat until or wait until Control block, reset, stop or changing program.

Here's a way that this block can be used:

Listening

This block is true when your script is recording speech and sending it to be evaluated by the Cortana Dictation webservice (Speech Recognition and Cortana Dication must be enabled through Sensors on the Settings Menu). This allows you to make your robot do something while waiting for speech.

Here's an example that makes your robot's eyes blink whenever it's listening to you:

Speech

This block is only available if your App is configured to use Ohbot Version 1.  It gives a number between 0 and 10 based on the phoneme of the speech that Ohbot is speaking. This can be combined with a setMotor (MouthOpen motor) block to move Ohbot's mouth in time with it speaking.

Toplip

This block gives a number between 0 and 3 based on the top lip movement for the phoneme of the speech that Ohbot is speaking. This block can be combined with a setMotor (TopLip motor) block to move your robot's mouth in time with its speaking.

There's an example of this in: George's face tracking example program.

Bottomlip

For Ohbot this block gives a number between 0 and 5 based on the bottom lip movement for the phoneme of the speech that Ohbot is speaking. For Picoh the range of this block is limited to 0 to 4 to prevent it from forcing Picoh into its smile position. This block can be combined with a setMotor (BottomLip motor) block to move your robot's mouth in time with its speaking.

There's an example of this in: George's face tracking example program.

Sound

This block gives a number between 0 and 10 based on the volume of any sound that's playing. You can choose from the list whether you want to monitor the sounds that are played as part of your program, sounds playing through the computer speakers or sounds coming into the computer microphone. You can use an Operator block to add 5 to this value and use it in a setMotor (BottomLip and/or TopLip motor) block to move your robot's mouth in time with sound. Note that monitoring the speakers will always monitor your Windows default playback device and that on some computers it's not possible to monitor the sound through the speakers due to the electronics of the sound card.

Camera X

This block is used to track a face or movement that's "seen" by the camera.  Select from the list whether you want to track faces or movement.  This gives the position of the centre of the face or movement in the x axis as a number between 0 and 10. 

A face is shown in the Camera Window as a dark blue square.  Movement is shown with a light blue circle.

Camera Y

This block is used to track a face or movement that's "seen" by the camera.  Select from the list whether you want to track faces or movement.  This gives the position of the centre of the face or movement in the Y axis as a number between 0 and 10.

A face is shown in the Camera Window as a dark blue square.  Movement is shown with a light blue circle.

For an example of how to use the Camera X and Camera Y blocks to make your robot track faces please see: George's face tracking example program

Camera Detected

This sensor block gives a count of the number of faces or areas of movements detected by the camera. Select from the list whether you want to count faces or movement. Note that to detect more than one face you need to have face detect type set to Average in the sensor setting from the settings menu.

You can use Camera Detected in an operator such as greater than, less than or equal.  Note that in previous versions of the Ohbot app this block was called Faces Detected.

Camera Size

If a face or area of movement is detected this sensor block gives the size of the face or movement that the camera can "see" as a number between 0 and 10. You can use this to run a sequence when someone is close to the camera or moves a lot.  Note that in previous versions of the Ohbot software this block was called Face Size.

Camera Change

If a face or area of movement is detected this sensor block gives the distance that the centre of this face or movement has moved since a face or movement was last detected as a number between 0 and 10. You can use this to run a sequence that reacts to fast movements of a face or movement.  Note that in previous versions of the Ohbot app this block was called Movement.

Camera Colour

This sensor returns the colour the camera can see in the centre of the Camera Window converted into a number between 0 and 10. The colour is the hue of the colour which ranges from red through yellow, green and blue and back to red again. You can use the Colour Name block to get a description of the colour.  A box showing the area that's being sampled is displayed in the Camera Window when you use this block.

Appearance

This block uses Microsoft Cognitive Face Services to analyse the most recent image where a face was detected. The image is uploaded to Microsoft's website about once every ten seconds (you can change this by selecting Setup from the Cloud AI Menu) so you need an internet connection and there is a slight delay in retrieving information. If there's more than one person in the image it will choose one at random.

To use this feature you can purchase Ohbot Credits by selecting Purchase from the Cloud AI menu.

Alternatively you can create an Azure Face API account on the microsoft cognitive services portal then enter the ID for your account by selecting Setup from the Cloud AI Menu.

Once you are setup you can restart the Ohbot App and the Appearance block will appear in the Sensor blocks. You can select the type of face analysis that you want to use from the dropdown list:

Please note that you need to agree to Microsoft's terms and conditions when you create your ID.

Camera Saturation X

This block gives the X position within the camera frame of the highest saturation of the colour that's typed in the box. You can use this to get your robot to track the position of a ball or any brightly colour object.  The point of highest saturation will be displayed in the Camera Window when you use this block in a sequence.  The colour to put in the box is a bit hit and miss and depends on the camera but here's a rough guide:

You can also turn on display of Camera Colour by clicking the box next to it and then see what numbers it shows when you hold different colours in front of the camera.

Camera Saturation Y

This block gives the Y position within the camera frame of the highest saturation of the colour that's typed in the box. See the description for Saturation X (above) for more information.

Colour Name

This block converts the number that's typed into the box into a name for a colour:

Input

If your have sensor inputs connected to your interface board this block can be used to read from them. The inputs blocks that are shown are preset to work with the Ohbot sensor pack but you can change them yourself by using the Inputs screen from the Settings Menus. This type of input block is used for sensors that produce a variable value between 0 and 10.

Input

If your have sensor inputs connected to your interface board this block can be used to read from them. The inputs blocks that are shown are preset to work with the Ohbot sensor pack but you can change them yourself by using the Inputs screen from the Settings Menus. This type of input block is used for sensors that produce an on/off (boolean) value.

Micro:bit

If your have a micro:bit connected to your PC this block can be used to read from it. Follow the instructions here to program your micro:bit and install a driver then plug the micro:bit into a USB port. You can drop down the list to decide which sensor on the micro:bit to use in your program. Go to micro:bit on the settings menu to rename your sensors or adjust their range.

Sensor

If your have i2c sensor inputs connected to your interface board this block can be used to read from them. This block will only appear if you have a file called i2cdefinitions.oid in Libraries\Documents\Ohbot. There's more information about this in the Sensor Pack add-on.

Reset Timer

This block resets the timer in the sequence back to 0.

Timer

Each sequence has its own timer. This block gives the time in seconds since the sequence was first started. If you tick the box next to timer it displays the overall time since the first time a program was run.

Current

This block give information about the current date, time, day of week and so on from the computer clock.  You can select the type of information that you want the block to report from the list.

Weather

This block gives a number based on the weather from open weather map:
WeatherUnusual = 0
WeatherSnow = 1
WeatherRain = 2
WeatherCloud = 3
WeatherSun = 4
These could be combined with an If block to have your robot say different things depending on what the weather is like.
You can set the location for the weather on the Sensor page on the Settings menu.

Weather Description

This block gives a description of the weather, which is always in english, from open weather map You can set the location for the weather on the Sensor page on the Settings menu

Temperature

This block gives the current temperature sourced from open weather map.
You can select whether this is degrees Celcius or degrees Fahrenheit by selecting Advanced from the Settings menu.

Webservice

This allows you to call an external webservice with a parameter from inside the program and do something with the information that the webservice returns. For example you could use this block

to speak the results of a Wikipedia search. The webservices that this block can call are defined in the file webcalldefinitions.owd in Libraries\Documents\Ohbot. You can edit this file by clicking on the icon on the right of the block or by editing it in a text editor such as Notepad. There's information about the contents of this file on the technical notes section of the Ohbot Website.

Database

This block lets you read phrases or other information from a database.  The database is defined in a comma separated values (CSV) file in the folder Libraries\Documents\Ohbot which can be edited by clicking on the icon at the right of the block or by loading it into a spreadsheet program.  You can select which phrase from the database should be read by putting text or blocks into the two empty boxes on the block.

There's more information about databases in the technical notes section of the Ohbot Website.

MessageParameter

If you use a when I receive block to start some code when a message is broadcast this allows a parameter to be passed by the message that was broadcast. For example you could pass the answer to a question to a message block (see example below)

MessageId

If you use a when I receive block to start some code when a message is broadcast this allows you to identify the id of the robot that sent the message. The id is set in the Ohbot Unique Name setting in the Advanced Window on the Settings Menu. It can be useful to know the ID of the originator of the message for Shared and Custom messages that are sent across a network.

Here's an example of what you could put in the broadcast message on the sending robot to send a variable parameter from an ask and wait block to another robot:

and here's what you could put in the when I receive block on the robot that receives the message to say what the message was and the name of the robot it came from:

Immersed

This block only appears if you have Immersive reader set up through Setup on the Cloud AI menu. It is true when the Immersive Reader window is displayed. This block is only of use in the hidden program called Immersive in Documents\Ohbot\Hidden that runs in the background when the Immersive Reader Windows is displayed.

Data

Data blocks let us use and modify Variables and Lists. We can think of variables like a box we can put a number or some text in. Lists are like variables but they let you work with a group of items.

When you display a variable or a list by clicking the box next to it you can type directly into the display to change the list or variable. Each member of a list is separated by a | character.

The current values of lists and variables are saved with a program when you save it. The reset button clears all the current variable and list values.

Create Variable

This button is used to create a new variable. Make sure you name it something sensible that will help you remember what you are using it for.

Variable

This block lets you use a variable in your program, you can drag it on any box where you can type a number.

Set Variable

This block sets the value of the variable you choose to whatever is in the box. The box could hold another block or you could type in a number or some text.

Change Variable

This block changes the value of a numeric variable that you choose by whatever is in the box. The box could hold another block or you could type in a number.

Here's some code to try out:

When you press the up or down arrow keys the happiness variable changes value. The tilt of the head is set by the value of the variable and the eye tilt is set to 10 - the value of the variable to keep the eyes straight.

Create List

This button is used to create a new list. Make sure you name it something sensible that will help you remember what you are using it for.

List

This block is mainly there so that you can see and edit the list members. You can use it in a sequence but it will return all of the entries so it's not very useful to do this.

Add To List

This block adds the number or test in the box to the selected list.

Delete From List

This block removes an entry from the list. 1 is the first entry. You can type a position into the dropdown or use it dropdown to delete all entries in the list or the last entry.

Insert Into List

This block inserts the number, text or block that's in the box into the list at a position. 1 is the position of the first entry in the list. You can type a position into the dropdown or use it to insert at the end of the list or at a random position.

Replace In List

This block replaces an item at a position in the list with the number, text or block that's in the box. 1 is the position of the first entry in the list. You can type a position into the dropdown or use it to replace at the end of the list or at a random position.

Item Of List

This block is used to retrieve an item from the list. 1 is the position of the first entry in the list. You can type a position into the dropdown or use it to retrieve from the end of the list or from a position at random.

Length Of List

This block is used to retrieve an item from the list. 1 is the position of the first entry in the list. You can type a position into the dropdown or use it to retrieve from the end of the list or from a position at random.

Item Of List

This block can be used in a testing block like If then to see if the list contains the entry that's in the box.

Here's some code to try out:

When you click on the green flag an entry from the list is spoken at random.  The Space, A, B and C keys change the contents of the list.  If you click the box next to the Moods list you will see the entries of the list displayed and you can type into there to change them..

Operators

Operator blocks let you work with numbers. Blocks with boxes can either have a block dragged onto them or a number typed in.

Plus

Add one block or number to another block or number.

Minus

Subtract one block or number from another block or number.

Multiply

Multiply one block or number by another block or number.

Divide

Divide one block or number by another block or number.

Pick Random

This block gives a random number each time it is run. You can set the minimum and maximum number that could be generated

Less Than

This block has two boxes that can contain a number or another block. The block is true if the value of the left hand box is Smaller than the value of the right hand box, otherwise it is false.

Equal To

This block has two boxes that can contain a number or another block. The block is true if the value of the left hand box is Equal than the value of the right hand box, otherwise it is false.

Greater Than

This block has two boxes that can contain a number or another block. The block is true if the value of the left hand box is Bigger than the value of the right hand box, otherwise it is false.

Less Than Equal To

This block has two boxes that can contain a number or another block. The block is true if the value of the left hand box is Smaller than or equal to the value of the right hand box, otherwise it is false.

Greater Than Equal To

This block has two boxes that can contain a number or another block. The block is true if the value of the left hand box is Bigger than or equal to the value of the right hand box, otherwise it is false.

And

This block has two spaces to hold other blocks. The block is true if Both of the blocks you drop on it are true.

Or

This block has two spaces to hold other blocks. The block is true if either of the blocks you drop on it is true.

Not

This block has a space to hold another block. The block is true if the block inside it is false or false if the block inside it is true.

Join

This block is used to connect two words or sentences together. Remember to put spaces on the start or end of your words else they will combine into a single word

Contains

This block is used to check if a word or phrase contains another word or phrase. The block is true if the second phrase appears anywhere in the first, otherwise it is false. It doesn't matter if words have capital letters

Letter of

This block is used to return an individual letter from a word. The first letter of the word is at position 1.

Length of

This block gives you the length of a word.

Here's an example that uses letter of and length of for an automatic spelling bee:

Mod

This block gives the remainder left over when the first box is divided by the second box. For example 10 mod 7 is 3.

Round

This block gives the rounded value of a floating point number. For example, if a sensor gives a value of 1.77 this block will convert it to 2.

MultiBlocks

Multiblocks allow you to use a single block to represent a whole Ohbot script. This helps with structuring a complex program and also allows quick methods for adding commonly used features such as blinking and lip synchronisation.

Multiblock

To create your own multiblock drag the block with the title New Multiblock onto your canvas. If you have a script for it already click on the choose button and select it.

Note that scripts for Multiblocks are stored in Documents\Ohbot\Multiblocks. If you select a script from another folder using the choose button it will be copied to there.

If you want to create a new script click on the view button to create a blank script. You can change the name of the script by clicking on the name in the tab and changing it

Once you’ve finished your script, save it by selecting Save or Save As from the File menu and close the tab. Make sure that you save your script in the Multiblocks folder.

Now click the green flag or start whatever other event is used to start the script that you’ve just associated with the Multiblock is run.

You can rename your Multiblock by clicking on the New Multiblock text at the top.

You can enable or disable the Multiblock with the tick box at the top right:

To change the layout of the multiblock right click on it. Select standard to display all the controls, no parameters to just display the title and sizing arrow or image only to only show the image.

To change the picture right click on the multiblock and select replace image. Any image you choose will be copied to Documents\Ohbot\Images. Images that have transparent backgrounds will be highlighted when you hover the mouse over the block. Images will not be highlighed when you hover if you size them carefully.

If the script associated with your multiblock has any variables you can set the value of these on the multiblock. You can see this in our Blink example. The script associated with Blink uses a variable called maxBlink to determine the maximum wait before a blink is repeated

When you drag the Blink multiblock into your program you can set maxBlink on the block:

You can see this in action by changing maxBlink to 1 and restarting the program. Note that the 3 example scripts that appear on the MultiBlocks palette are defined in a file in Documents\Ohbot called multiblockdefinitions.opd. You can edit this in Notepad and add your own multiblocks to the palette.

Comments

You can add a comment to any block by right clicking on the block and selecting add comment from the menu. You can also add a free comment that isn't attached to a block by right clicking on the Programming Window.

You can delete a comment by dragging it to the part of the screen that you select blocks from.

You can position the comment by clicking and dragging the top of it. A block comment will move when the block that it's attached to moves. A free comment can be attached to a block by dragging it and dropping it on the block.

You can size the comment by clicking and dragging on the arrow in the bottom right corner. You can "close up" a comment by clicking on the circle in the top left corner

Examples

Here are some tips and example sequences to help you get started with your robot. 

Move Ohbot's mouth in time with speech



The toplip and bottomlip motion blocks allow you to move your robot's lips. You might have noticed that if you use these blocks on their own your robot's mouth does not move in time with speech. To get this to happen we use the toplip and bottomlip sensor blocks inside a loop to set the toplip and bottomlip motor blocks.

The toplip and bottomlip sensor blocks give a numbers between 0 and 5 that represent the phoneme of the word that your robot is saying. By updating the position of the lip motors to these numbers your robot will open its mouth in time with anything it is saying. In order to ensure this keeps updating we put this inside a forever loop meaning it will run continuously round once the green flag is clicked.

Note that if you are using v1 Ohbot the same thing is done by moving the mouth motor using the speech sensor variable

George's face tracking program



George has written a sequence for his Ohbot which starts when the space key is pressed.  This makes the head nod motor move in a sequence and speaks phrases.

George has written a second sequence which starts when the up arrow key is pressed.   This uses the camerax and cameray sensor blocks to set the positions of the head turn and head nod motors - the program starts running and has the result of turning Ohbot towards where it sees a face on the camera screen. By putting the set motor block inside a loop the position of the motor is updated over and over again and so will follow any changes in the input.

George has written two other loops which start when the green flag button is pressed.  One makes Ohbot blink by by combining set motor blocks and wait blocks.  The other makes Ohbot's lips move in time to any speech.