Swipe to navigate through the chapters of this book
You’ve seen a lot of examples of powering LEDs—turning them on and off from our IoT device. There are a lot of interesting things you can do with LEDs. For example, have you wondered how a power meter works? If you have used high-end audio equipment, such as a studio sound board, you may have seen a power meter that has several segments ranging from green to yellow to red where green means the level is low, yellow is medium, and red is high. You can duplicate this behavior with a set of LEDs and your IoT device. Yes, you’re going to build a fancy LED power meter!
Please log in to get access to this content
To get access to this content you need the following product:
And here’s another one!
For more information about SPI, see https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus.
There are other ways to do this, but this uses a technique we’ve seen previously.
You don’t have to name it InitGPIO(), but that is the common theme. Actually, any reasonable name is fine; but if you are going to share your code, InitGPIO() is a good name.
For mode explanations, see www.byteparadigm.com/applications/introduction-to-i2c-and-spi-protocols/.
- Project 1: Building an LED Power Meter
- Sequence number
- Chapter number
- Chapter 10
Neuer Inhalt/© ITandMEDIA