Controlling the Pi’s GPIO with Scratch
Oct 19, 2021
5 minutes
Scratch is meant for learning to code. It uses blocks to depict code and we can build sequences (algorithms) with relative ease. If something goes wrong we can take it apart and diagnose our code. As we’ve covered in previous issues, Scratch can also be used with the GPIO of a Raspberry Pi to learn electronics and in this tutorial we shall learn how to work with inputs such as buttons and a PIR sensor to control simple outputs such as LEDs.
Don’t let the simplicity of this fool you. Adding the PIR sensor to our robot project () and tweaking the code will enable our robot to detect an obstacle, and then move around it. But before we can do that we need to know the basics, so here we go!
You’re reading a preview, subscribe to read more.
Start your free 30 days