Small Basic, one of our favorite learning languages, marry that up with the Raspberry Pi and you got some tasty IoT!
This blog is about communicating with a Raspberry Pi using Small Basic.
The Raspberry Pi is a small cheap computer. It has no keyboard, monitor or other usual computer peripherals so is an ideal candidate to communicate with using Small Basic.
Summary of Connection
Since the Pi is a fully working computer in its own right, the connection is really a connection between 2 computers.
As Philip says there are several ways this can be achieved (for example using a serial port), but the method he selected doesn’t even need an extension. It uses the Small Basic Network object.
Table of Contents
- How to control a device from Small Basic
- The Raspberry Pi
- Raspbian Linux Operating System
- The Thin Server
- A Thin Server for GPIO
- GPIO Server API
- Putting It All Together
Imagine we would like to turn on and off a light from a Small Basic program: A classic embedded systems task.
There are several ways to implement such a system. In the old days, one would build a microcomputer with an RS-232 serial port into the light controller. You would then connect a cable from the serial port on the device to the serial port on the Windows computer, possibly with a 25-9 pin adapter, crossover cable, null modem adapter, etc. Then you would try to figure out the baud rate, parity settings, and which serial port was which on your computer. If you were determined you would eventually get it working. After installing the LitDev extension for serial port support, you can now control the light from Small Basic by sending commands out the serial port to the light controller.
The cable challenges and bit rate limitations of serial ports led to the introduction of USB (Universal Serial Bus), which standardized the cabling and increased the baud rate by orders of magnitude. But USB brings its own peculiar challenges, including the fact that devices can wind up at different addresses depending on which port they are plugged into. Still, one can now build a microcomputer with a USB port into the light controller and eventually get it working from Small Basic using the LitDev extension.
A third option is to build a microcomputer with either wired or wireless Ethernet into the light controller. If the microcomputer runs a mini-web server with something like CGI (Common Gateway Interface ), one can easily issue commands to it from a web browser, or from Small Basic using the Network object.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.