First Programs: 1. Driving
Now we're all set up and ready to start. Let's take the intelino train for a spin!
Make sure Scratch Link is running on your computer, turn on the train and connect it to Scratch. If you need any help with the setup, follow the steps described in the previous articles (Installing Scratch Link and Connecting intelino Train to Scratch).
Now, lets setup a simple circle track and place the train on it:
Find the drive block, drag it to the program workspace and click on it.
You should see the train start driving forward! Simple, isn't it? Your program has just one command that tells the train to start driving forward at 30 cm/sec.
If you like, try making change in the block, e.g. set the movement direction to backward or change the speed value. Then click on the block again to run your modified command. You should see the train respond with your desired change immediately.
Since the train is still on the move, let's try a command that will stop it. First, remove the drive block from the workspace by dragging it to the left of the screen. Then find the stop driving block, drag it over to the workspace and click on it.
As expected, the train will come to a stop the moment you run the command.
Now that we tried the basics, let's put together a simple program sequence using both of the blocks we tried. Note that if we were to simply add a stop driving block right under the drive block, the train would never actually move. The reason is that the stop driving command would execute immediately after the drive command, so the train would never get a chance to get going. For this to work, let's use a wait block from the Control category and insert it right after the drive block as shown below:
As you can see, we set the wait to 5 seconds. Now, if you click on the program (which makes it highlighted in yellow), you should see the train do exactly what the program says: start driving and then stop exactly after 5 seconds.
Let's try programming with some other blocks in the next example!
Next Article: First Programs: 2. Events
Previous Article: Connecting intelino Train to Scratch