- Motion control blocks
- Servo blocks
- Sensor blocks
- Speech blocks
- General blocks
Motion control blocks
A motion is a set of movements. For example the 'walk forwards' motion instructs your Edbot to walk a few steps forwards. As each servo moves, it will light up in a specific colour to add a stunning visual effect to the motion. Your Edbot comes pre-loaded with lots of motions which are arranged in six categories to make things easier to find:
basic, dance, fight, greet, gym & sport
Your Scratch script will wait until the motion has completed before moving on.
You can also run a motion by number, starting from 1. This is useful if you want to cycle through the available motions, for example.
Set motion lights
Normally your Edbot will automatically light up in an aurora of colours when it is performing a motion. This is great to look at, but you may want to set the motion colours yourself. You can turn off the automatic motion lights using this block. You can then use the servo colour block (described below) to set the servo colours before you run a motion. Remember to turn them off when the motion has completed. For example, try setting all servos to green when walking forwards and red when reversing.
Get motion name
Give this Scratch reporter block a motion number and it will give you the motion name in return. If the motion number is unknown, empty text (zero length) will be returned.
Single servo blocks
These blocks let you control individual servos. You can turn a servo on or off, set the colour, speed and position of a servo and get its current position. All of the blocks, with the exception of servo position, offer an "all" option to address all the servos at the same time. If you need to control a range of servos simultaneously, use the multi servo blocks described below.
Set servo on/off
With all servos turned off, your Edbot will be all floppy. Use this block to turn a servo on or off. Note that when you run a motion the servos will be automatically turned on and left on for subsequent instructions.
Set servo colour
Use this block to set the colour of a servo to your chosen colour. Use the same block to turn the servo light off. You can use a number in place of a colour name here, see the list below.
Set servo speed
Set the servo speed for the next servo position block. This can be applied to a specific servo or all servos at the same time. The speed is a number from 1 to 100 inclusive. Setting this to 100 will effectively set the maximum servo speed which can be quite snappy, so mind those fingers!
Set servo position
Move an individual servo to the position specified between 0 and 300
degrees. See the diagram below:
You need to be a little careful here. It's a good idea to check the current position of the servo before moving it to a new position in case you end up tying your Edbot up in knots. Get the servo position from the current position block described below. If you're unsure you can do something seriously cool like this, to move servo 1 by 10 degrees:
Get servo position
This is a Scratch reporter block which gives you the current position of a servo. Useful for more advanced scripting.
Multi servo blocks
These blocks allow you to control a range of servos simultaneousy.
Set servos on/off
Turn a range of servos on or off. Specify the servo by number followed by "/" followed by 0 or 1 to turn the servo off or on respectively. Specify multiple servos by repeating the sequence, for example "1/0/2/0/3/1/4/1". Servo number 0 means all servos, so "0/0" will turn all servos off.
Set servo colours
Set the colours of a range of servos. Specify the servo number followed by "/" followed by the servo colour index as defined in the colour table. Specify multiple servos by repeating the sequence, for example "1/3/2/3/3/3/4/3". Servo number 0 means all servos, so "0/3" will set all servos to colour index 3.
Set servo speeds
Set the speed of a range of servos. Specify the servo number followed by "/" followed by the speed expressed as a percentage greater than zero. Specify multiple servos by repeating the sequence, for example "1/50/2/50/3/50/4/50". Servo number 0 means all servos, so "0/12.5" will set all servos to one eighth speed.
Set servo positions
Set the position of a range of servos. Specify the servo number followed by "/" followed by the position which is an angle from 0 to 300 degrees, see the servo diagram. Specify multiple servos by repeating the sequence, for example "1/250/2/50".
Get servo positions
This is a Scratch reporter block which gives you the current position of each servo. Useful for more advanced scripting.
Set distance sensor
Your Edbot continuosly sends servo and sensor data to the Edbot software. However you may need to get the servo data as quickly as possible, for example if you’re doing motion capture. Use this block to turn off the distance sensor so your Edbot only sends servo data.
Get distance sensor
This reporter block returns the current distance sensor reading. The distance sensor is mounted on the Edbot's head and measures the distance in centimetres to an object in front of your Edbot. The sensor was calibrated using the distance between the front edge of the feet and a vertical white A4 card. Note the sensor may give different measurements for different coloured objects placed the same distance away. The reading should be interpreted as an approximate distance.
The following blocks instruct your Edbot to speak! The voice, language, volume, pitch and speed will have been set up during Edbot configuration.
|Try configuring your Edbot with a different language, if you have the voices available. You can then type text in your chosen language in the speech blocks!|
Say the words! This block won’t wait for the speech to finish before continuing to the next block.
Say and wait
Say the words! This block will wait for the speech to finish before continuing to the next block.
This will stop the current command, turn all the servo lights off, set the motion lights / sensor to defaults and halt any speech on a word boundary. It won't turn the servos off however, just in in case your Edbot is in the middle of an amazing acrobatic routine.
This reporter block returns 1 if your Edbot is connected to the Edbot software or 0 if not.