Chapter 19
The General-Purpose Input/Output Port in RISC OS
In This Chapter
Seeing how to access the GPIO pins under RISC OS
Making an LED blink
Mixing BASIC and machine code
In this chapter, we show you how to use the GPIO pins under RISC OS. We present the obligatory flashing LED, a sort of “Hello world!” for hardware. We also tell you how to speed up output using machine code embedded into the BASIC program. Finally, we show you how to read a GPIO input.
When you know the fundamentals of using the GPIO from RISC OS, you can handle any interfacing project. After reading this chapter, you may want to try to write the programs for the projects in Chapters 5 and 6 in BBC BASIC instead of the Python we used. Have fun using this hidden side of the Raspberry Pi!
Using the GPIO Pins in RISC OS
In the last chapter, we look at using the I2C bus, which occupies just two of the pins of the GPIO connector. Both the Raspberry Pi Model A and the Raspberry Pi Model B have 17 pins available to control or monitor things, whereas the Raspberry Pi Model B+ and Raspberry Pi 2 Model B+ have 28 pins. However, in order to talk to these pins under RISC OS, you have to resort to a little trickery. ...
Get Raspberry Pi Projects For Dummies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.