Basic Scratch Robot

Basic Scratch Robot

This is a basic example for using Scratch with GoPiGo. Raspbian for Robots comes pre-installed with Scratch and the Scratch library for the GoPiGo.

In this example we’ll use a small example to control the GoPiGo from a Scratch program using keyboard commands.

Connect to the GoPiGo

Make sure that the GoPiGo is set up properly and you have the updated software and firmware. If you are not sure about this, follow the guide here

If the GoPiGo is properly set up, connect to it via VNC, or through your browser.

Dex_desktop

 

Start Scratch for Robots

Double click the “Scratch” icon on the desktop (identified here with the green arrow) to start Scratch for Robots, the program which communicates between the GoPiGo and Scratch.

This will open two windows, a black terminal window called the Scratch Controller and the Scratch for Robots interface. Do NOT close the Scratch Controller, as that will kill all communications between Scratch and the robot!

You can then click on “Open Examples” to find the basic robot example.

Scratch_For_Robots

 

Start Basic Test

Double click the GoPiGo_Basic_test.sb in the Examples window.

GoPiGo_Basic_test

Double-clicking the basic demo test will launch a confirmation window. If you already have Scratch up, now is a good time to save your work as you can only have one instance up and running. Make sure the GoPiGo robot is selected, and click on Start Programming!

Start_Programming

 

Confirm the next window that will pop up and Scratch will start up!

You should see Remote sensor connections enabled popup after loading the example. This means that the program is now connected to the GoPiGo.

remote_conn_en

 

Running the program

Press the Green Flag on the top right corner to start the program. To control the GoPiGo, press:

  • Up arrow– move forward
  • Down arrow– move back
  • Left arrow– turn left
  • Right arrow– turn right
  • w-Increase speed
  • s-Decrease speed
  • o & p – control left LED
  • k & l – control right LED
  • Space– stop

basic_example_running

Stop the program once you are done by pressing the Red Flag.

Have a question? Go check out our support page here or post it on the forums here

{"cart_token":"","hash":"","cart_data":""}