Skip to main content
100%

Gist fe5ce76b0cc840bc080dd743b85da077

✓ Published0🌍 Public
UUtopiah
Last edited Oct 25, 2020
Created on Oct 24, 2020

This example shows a web-controlled traffic light system using a Raspberry Pi’s GPIO pins. Three colored LED lights (red, yellow, green) are toggled via HTTP requests served by Express. The interface presents three full-width color blocks that link to `/start/red`, `/start/yellow`, and `/start/green` routes, each writing a high signal to the corresponding pin using the `onoff` library’s `Gpio` class. A `/stop` route resets all pins to low, while `/shutdown` unexports the GPIO resources. The code runs as a persistent Node.js process.

AI-generated description

Similar vizzes