Robotics with ScratchGPIO

ScratchGPIO supports many different retail robotic vehicles and they share a number of common features.

First thing to do is identify what make/model of robot you have.

Then create a variable called AddOn and then in your On Green Flag event – set it to the name of your model e.g.

All supported vehicles have 2 wheels powered by DC motors.  To control them,  you need to create 2 variables to control the 2 motors.

The name of the variable depends on the names used by the manufactures but are commonly MotorA and MotorB, MotorL and MotorR or Motor1 and Motor2.  Create the appropriate variables and set them to zero in your Green Flag event: e.g.

The speed of the motors can be set from -100 (full speed backwards) to 100 (full speed forwards) e.g.

The most common other pieces of hardware are an ultrasonic sensor, on the front, which measures distance  and Infra-Red (IR) line sensors mounted underneath the robot usually close to the 3rd caster wheel/ball.

The ultrasonic sensor distance value is available in the Scratch, light blue ,sensing category – click on category, scroll down to the bottom and click on the little black arrow next to slider.  This will then show you the sensors available to use e.g.

To show the value on the stage, select one of the sensor values in the bottom section and then click on the grey box.

Please select your specific robot type from the addons section of this website to see all the options for yours