O'Reilly logo

Raspberry Pi, 2nd Edition by Maik Schmidt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Build an Out-of-Memory Alarm

Turning an LED on and off using software is an important exercise, but it’s certainly not a very useful project. Usually, you won’t control LEDs manually, but you’ll use them as status indicators. For example, many USB devices use LEDs to show whether they’re reading or writing data at the moment.

In this section, we’ll use three LEDs as status indicators for the Pi’s current memory usage. The LEDs will have the same colors as a traffic light. If the Pi’s memory is critically low, we’ll turn on the red light. If a lot of memory is available, we’ll turn on the green light. Otherwise, it will be yellow.

In Figure 49, Memory alarm circuit diagram, you can see the circuit of the memory alarm. In Figure 50, The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required