Introduction

Welcome to the Ohbot help page.

To bring your Ohbot to life you need to give it instructions. Ohbot instructions are written using blocks that do different things. There are blocks to help move Ohbot's motors, speak, use 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 sequences of instructions programs.


The blocks in an Ohbot 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 Ohbot do different things.

Environment

This is the Ohbot programming environment.

Motion

Ohbot has 6 Motors that can move and you can control each of them 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:

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

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

set motor acceleration

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

set motor speed

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

Events

When you are writing a block of Ohbot code it needs to start with an event block.

when flag clicked

Start a program when the green flag button is clicked.  Stop all programs when the red button is clicked.  Reset Ohbot when the orange button is clicked.

when ______ clicked

This block starts a program when you press a key on your keyboard, choose which key from the drop down list. You can use more than one of these blocks in one program so Ohbot does different things depending on which key is pressed.

When Word Heard

This block starts a program when Ohbot hears you say a certain word. The words Ohbot can understand can be set from the Sensing screen on the Settings menu. Using a smaller vocabulary of words makes Ohbot's speech recognition more accurate

When I Receive

This event block will start when the message you choose is received.

Broadcast

Use this block to send out a message from within a program for a when i receive block to pick up.  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 block that receives the message in the message parameter sensing variable.

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 value or a block in the box to the right of the message name this can be picked up by the block that receives the message in the message parameter sensing variable.

New Message

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

You can use a shared message to send messages to another Ohbot on a network.  Just set the shared message path in the Advanced menu to the same network path on both Ohbots. 

You can use 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 Ohbot for a custom message.

Speech

These blocks are used to control Ohbot's speech.

say

Ohbot will speak the words you type into the text box on the block. The next block in the program will run straight away without waiting for the speech to finish.

say _____ until done

Ohbot will speak the words you type into the text box on the block the same as the say block. The next block in the program will run once Ohbot has finished speaking.

stop all speech

This block stops Ohbot's 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 program. 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 Ohbot blink in:
George's face tracking example program

wait until ____

Wait until a statment is true before moving onto the next block in the program.

These blocks will make Ohbot 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 program 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 Ohbot 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 Ohbot repeat the words "Is there anybody there?" Until the camera sees a face.

if ___ then

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

This sequence will make Ohbot 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 code inside the block once, if it is false run a different (else) block of code.

This sequence will make Ohbot 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 Ohbot will say "It's not sunny today".

stop

Stop the program running.

Sound

Ohbot 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 Ohbot to life. There are special blocks you can use to play and stop sounds inside your program.

play sound

Ohbot 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

Ohbot 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.

stop all sounds

This block stops any sounds that are playing.

Sensing

The sensing blocks are used to get input from the outside world into your Ohbot 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.

CameraColour

This sensor returns the colour the camera can see converted into a number between 0 and 10.

CameraX

If the camera has deteced a face this sensor block gives the position of the face in the x axis as a number between 0 and 10.

CameraY

If the camera has deteced a face this sensor block gives the position of the face in the y axis as a number between 0 and 10.

For an example of how to use the cameraX and cameraY blocks to make Ohbot track faces please see:
George's face tracking example program

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.

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

Motor

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

FacesDetected

This sensor block gives the number of faces detected by the camera. You need to have face detect type set to average in the sensors setting from the settings menu.

We can use the faces detected in an operator such as greater than, less than or equal.

FaceSize

If a face is detected this sensor block gives the size of the face the camera can see as a number between 0 and 10. You can use this to run

ResetTimer

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

Timer

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

Speech

This sensor block 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. There is an example of this in:
George's face tracking example program.

Toplip

This sensor block gives a number between 0 and 5 based on the top lip movement for the phoneme of the speech that Ohbot is speaking.

Bottomlip

This sensor block gives a number between 0 and 5 based on the bottom lip movement for the phoneme of the speech that Ohbot is speaking.

KeyPress

This block gives a value of 1 if the key is pressed or 0 if it isn't.

Movement

KeyPress

This block gives a value of 1 if the key is pressed or 0 if it isn't.

Input

If your interface board is configured as an input device then this block gives the value input on the specified pin

Weather

This block gives a number based on the weather from yahoo:
WeatherUnusual = 0;
WeatherSnow = 1;
WeatherRain = 2;
WeatherCloud = 3;
WeatherSun = 4;
These could be combined with an If block to have Ohbot say different things depending on what the weather is like.

Temperature

This block gives the current temperature sourced from Yahoo Weather.

Current

AskAndWait

This block speaks what's in the text box and then waits for you to type a response.

AskAndListen

This block speaks what's in the text box and then waits for you speak a response.

Answer

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

Loudness

This block gives a value for the current volume of noise Ohbot can hear. You could use this, for example, to have Ohbot wake up when a certain volume of noise is heard.

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 the Ohbot sub-folder of the documents folder.

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 Ohbot that sent the message. The id is set in the Ohbot Unique Name setting in the Advanced settings. 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 Ohbot to send a variable parameter from an Ask and Wait block to another Ohbot:

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

Data

Data blocks let us use and modify Variables. We can think of variables like a box we can put a number in.

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 white box where you can type a number.

Set Variable

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

Change Variable

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

Operators

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

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.

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.

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.

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 the blocks you drop on it are true.

Or

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

Not

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

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 with 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

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.

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

Examples

Here are some tips and example programs to help you get started with Ohbot. Click the photo of the program to download the code.

Move Ohbots mouth in time with speech



The say blocks allow you to make Ohbot speak. You might have noticed that if you use these blocks on their own Ohbot's mouth does not move. To get Ohbot's mouth to move in time with the speech we use a speech sensor block inside the set mouthOpen motor block. The speech sensor block gives a number between 0 and 10 that represents how loud the words Ohbot is saying are. By updating the position of the mouth motor to this number Ohbot 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.



George's face tracking program



George has used the camerax and cameray sensor blocks to set the postions of the head turn and head nod motors. This 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. The code uses a separate set of blocks to make Ohbot blink. This runs in its own loop and is made by combining set motor blocks and wait blocks.