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:
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.
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.
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:
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.
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.
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":
Picoh only. Click on this block to create a new eyeshape in the EyeShape Designer.
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.
Picoh only. Use this block within a program to set the brightness of Picoh's eyes.
A sequence in a program must always start with an event block.
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.
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.
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. Click on the icon at the top right of the block to view and change the words that are recognized.
The sequence of events attached to this block is run whenever a word is spoken by Ohbot or Picoh. For example, this block could be used to move Ohbot or Picoh's lips to a smile position whenever the word "happy" is spoken. These can be particularly when using voice input or playing text from chat or Wikipedia when the text that’s spoken is not predictable.
This block stopped working and was removed in version 2.0.0.93 as the Twitter API was removed by X.
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!
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.
This event block will start when a message is sent to it with a broadcast or a broadcastand wait from another sequence 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 only the one on the leftmost tab will be run. Click on the icon at the top right of the block to view and change the available messages.
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
when i receive will also start if a say block is used to say text which contains the name of the message in square brackets
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). Click on the icon at the top right of the block to view and change the available messages.
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). Click on the icon at the top right of the block to view and change the available messages.
Here's some code to try out:
You can use this block to do something when the program is first loaded. For example you could move Ohbot to a sleep position:
These blocks are used to control your robot's speech.
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.
You can also put words in square brackets to broadcast a message when that point is reached in the text. For example:
Speech, captions and lipsynch are all suspended while the broadcast runs. If you need to pause the text without broadcasting you can put a number of seconds inside square brackets Please note that the position of broadcasts and pauses in the text is not completely accurate as it assumes that the speech is spoken at a constant rate
Note here that the lip sync multiblock is turned off during the smile by changing the value of the lipsync variable. The word smile is not spoken, it's just used to trigger the message
If you put a * in the square brackets in front of the message name the speech will pause until the broadcast is complete
Icons on the right of the block allow you to dictate into the say block (if Speech Recognition and Cortana Dication are enabled through Sensor on the Settings Menu), or size the text box
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 use {}, <> or [] to stress words, play sounds or start messages in the same way that you can with the say block
Icons on the right of the block allow you to dictate into the say block (if Speech Recognition and Cortana Dication are enabled through Sensors on the Settings Menu), or size the text box
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:
This block lets you set what voice your robot will use for speech. You can set the voice type that's used on the Advanced screen from the Settings menu. Note that the Azure voice type will not work if your app is not licenced.
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.
If you are using an Azure voice type you can also use this block to set emotion. Select emotion from the left hand list and then type the name of the emotion into the right hand box.
find out which emotions are available for your voice by checking the available speaking styles here
This block stops speech even if it is in the middle of speaking.
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 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
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 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 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 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 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 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 a new program either adding to the current program, replacing the current program or loading to a new tab.
Your robot can play back sounds or display images that are stored on your computer. You could try recording sounds like laughing or breathing and use these to help bring your robot to life or you could display images to help your robot tell a story. There are special blocks you can use to play and stop sounds and display images inside your program.
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.
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.
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.
This block sets the volume of the sound that's playing or about to be played.
This block stops any sounds that are playing in any sequence in the program.
Click on this button to record a new sound with your microphone.
This block will display the image where the robot simulation is. Use a blank name to restore the simulation.
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.
This sensor block gives the position of the motor you have chosen from the list as a number between 0 and 10.
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.
This sensor block gives the position of the mouse in the x axis as a number between 0 and 10.
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.
This block gives a value of 1 if the key that's selected from the list is pressed or 0 if it isn't.
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).
Please note that since beginning of April 2023 Cortana dictation has stopped working. We are trying to get this resolved with Microsoft but the only solution at the moment is to create your own Microsoft Azure speech account and configure the app to use this on the Cloud AI Setup page on the Settings Menu. There are links on that page for how to create an Azure account.
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.
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:
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:
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:
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
This block converts the number that's typed into the box into a name for a colour:
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.
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.
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.
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.
This block resets the timer in the sequence back to 0.
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.
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.
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.
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
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.
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.
This block allow you to translate between two languages. Note that an Ohbot Microsoft Cortana account is used to provide the translation. To use your own Cortana account enter your key on the Cloud AI setup page accessed from the Settings menu.
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.
This block gives the same functionality as a database block but allows a google sheet to be used for the data. As this sheet can be shared it makes it easier to update lists of speech.
The list of available databases is defined in the file Ohbot.gsd on documents\ohbot. For more information please have a look in the technical notes section of the Ohbot Website.
Similar to webdatabase taking its data from a google sheet but this block is specifically designed for getting information about forthcoming events.
The list of available databases is defined in the file Ohbot.gsd on documents\ohbot. For more information please have a look in the technical notes section of the Ohbot Website.
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)
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:
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 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.
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.
This block lets you use a variable in your program, you can drag it on any box where you can type a number.
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.
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.
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.
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.
This block adds the number or test in the box to the selected list.
This block creates a list of words by splitting a string of words that separated by space or |.
This block creates a list of phrases by scanning a string that contains phrases separated by carriage returns. It will only include lines that begin with the starting word followed by a colon and will remove the starting word and colon from what's put into the list
This block was specifically introduced to allow GPT conversations between two characters to be converted to lists of speech for each character
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.
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.
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.
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.
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.
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..
Operator blocks let you work with numbers. Blocks with boxes can either have a block dragged onto them or a number typed in.
Add one block or number to another block or number.
Subtract one block or number from another block or number.
Multiply one block or number by another block or number.
Divide one block or number by another block or number.
This block gives a random number each time it is run. You can set the minimum and maximum number that could be generated
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.
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.
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.
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.
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.
This block has two spaces to hold other blocks. The block is true if Both of the blocks you drop on it are true.
This block has two spaces to hold other blocks. The block is true if either of the blocks you drop on it is true.
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.
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
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
This block is used to return an individual letter from a word. The first letter of the word is at position 1.
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:
This block gives the remainder left over when the first box is divided by the second box. For example 10 mod 7 is 3.
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.
This block gives access to maths functions such as Sin and Square root.
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.
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.
AI blocks allow you to use advanced features relating to Artificial Intelligence.
Answers to questions can be defined using the AIML AI markup language which includes wild card matching and grammar substitutions. These blocks show how to use AIML for a basic chatbot:
Click on the icon at the top right of the block to view information about the AIML. After the block has run this will also show how the words that were produced were retrieved.
A Markov chain is a list of pairs of data with the probability that they occur. They can be used, for example, to analyse the style of text and then generate new text in this style. Data files are held in Documents\ohbot\markov. We provide one example, catmat, to show a simple example but files can be generated easily from any text by clicking on the icon at the top right of the block
A call to the markovchain block with no parameters will return a random word that was used to start a sentence in the original text. A call with a word will scan all the entries in the list where that word is the first word of a pair and return the second word of one of them at random based on probability. For example, if there are 7 instances of the pair “what if” and 3 instances of the pair “what will” in the text that was used to generate the Markov chain then passing the word “what” will return “if” 70% of the time and “will” 30% of the time.
This relates to Markov chains. It returns the number of times that the word that’s defined in the box starts a pair of words in the chain multiplied by 10. For example, in the catmat Markov chain the word “the” will return 3.33 here as 2 of the 6 entries begin with “the”.
From version 2.0.0.93 onwards you can use this feature without needing your own OpenAI account
In earlier versions set up an OpenAI account and go to the Cloud AI Setup page from the Settings menu to enter you key so that you can use this feature. You may need to add some pay as you go credit to your account before you can use it.
Information about the GPT parameters are available on the OpenAI website here
The models that are available in the dropdown on the gpt block are defined in the file documents\ohbot\gpt3definitions.ocd which can be edited in Notepad so if new models are added these can be added into here. Here's an example of how to use the block:
You can also pass the current image from your camera to GPT. Select the vision preview or vision preview hi-res model from the dropdown for this. Note that using the hi-res model can use up a lot of tokens, particularly if you have the width or height of your camera set to larger than 512 on the Sensor page off the Settings menu. Here's an example of how to use the block:
This is similar to the GPT block but is used to pass a URL to GPT for image recognition. It uses a separate file to define the available models documents\ohbot\gpt3urldefinitions.ocd.
Here's an example of how to use it:
This is similar to the GPT block but it will pass your conversation history back to GPT in a similar way to ChatGPT. It uses a separate file to define the available models documents\ohbot\gpt3historydefinitions.ocd
To start a new history you can type a new name into the middle box on the block or edit the ohbot one by clicking on the 3 line icon at the top right of the block and then using the new button.
By clicking on the three line icon you can edit the history - use ctrl or shift to delete multiple lines and remember to click the okay button and not just shut the edit window. The history files are saved in documents\ohbot\history and can be edited in there using a text editor like notepad.
History builds quite fast and at some point you will run out of OpenAI tokens. It also increases the size of your prompts so OpenAI costs are likely to be higher.
GPT Assistants are probably a better bet for keeping history in the longer term.
Available in version 2.0.0.93 onwards
This block gives access to OpenAI assistants which remember previous conversations and, if you are using your own OpenAI account, can be customised with additional knowledge by uploading documents.
If you are using your own OpenAI account you can set up your own assistants. Go to https://platform.openai.com/assistants to create an assistant. You just need to set a name, instructions, and the GPT model to use. It’s best to use one of the turbo ones as these are cheaper. You can add a file such as an html or txt file to provide information. (make sure you turn file search on else it ignores it). You can try out your assistant in the playground to make sure that it does what you want.
If you are using GPT without your own OpenAI account you will be limited to using one of the assistants that we have set up. These will still remember your conversation history but you will not be able to upload your own documents.
Start the Ohbot app and you should see this model appear in the dropdown on the gptassistant block:
The assistants available in the dropdown will be the assistants that you have set up or our default assistants rather than the ones shown here.
If you select remember on the second dropdown it will use the most recent thread for your conversation. If you select forget it will start a new thread for the conversation. This is so that you control whether the assistant remembers what you have told it previously. For example, you might usually use remember so that it remembers everything you have ever told it but for a robot receptionist you might want it to use forget the first time it sees a new person. A new thread costs 2 pence so best to try to use remember where you can. These blocks will remember that you are called Petra
These blocks will respond that your name is not known:
A thread will hang around for ages so you can come back to the program days or weeks later and these blocks will respond to you as Petra:
If you are using your own OpenAI account you can see all the threads that you have created if you turn this on in OpenAI settings by making threads visible to all organisation owners on this page: https://platform.openai.com/settings/organization/general
Then you can view all your threads on this page: https://platform.openai.com/threads
If you want your gptassistant to use a particular thread instead of the latest one (to continue with an old conversation) you can copy the thread id (which starts thread_) from the thread page and paste it into the remember/forget box on the block:
This block was called pva prior to version 2.0.0.93
This allows interaction with a Microsoft Copilot (previously called Power Virtual Agents) chatbot which can be configured to respond to questions about your products or your company using a Microsoft "no code" configuration tool.
Context about what questions have been asked and what informaton has been given is held for 30 minutes. If the copilot block is used after 30 minutes then a new session is started.
You can sign up to an account - you can try it out for free
The options that appear in the dropdown are defined in the file Documents\Ohbot\pvadefinitions.ocd and this can be edited in Notepad or similar. Settings are as follows:
Here’s an example script for a conversation with PVA:
Available in version 2.0.0.93 onwards
This allows use of Microsoft Azure AI features. You will need to request a Microsoft Azure AI account to use this block
Once you have an account set up a hub and a deployment and replace yourazuredeployment in the file Documents\AzureAIDefinitions.ocd with the name of your deployment. You also need to go to the Cloud AI Setup page from the settings menu and add your Azure AI key.
Once Azure AI is setup the block will appear on the AI panel and you can use it in a program in a similar way to the gpt block.
This stores a variable that will remain the same across sessions.
This block retrieves a variable that will remain the same across sessions.
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
Here are some tips and example sequences to help you get started with your robot.
When the green flag is clicked, the Lid motor will be set to 10 (eyes closed) the sequence will then wait 0.3 seconds and set the lid position to 4 it will then wait a random number of between 0 and 10 seconds. This sequence is repeated continuously while the program is still running. It is a good idea to use random numbers for wait times as this makes you robot act more naturally. The amount of time between each human blink changes and is not always the same.
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 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.