4. The Shoo-Away Button

Background

You know when you’re surfing the web, working extremely hard and then suddenly your boss wanders by? You need a rapid way to switch the active screen of your monitor. THAT is a Shoo-Away button.

Let’s build one.

We’ll leverage UART communication to form a tight synergy between the real world and our PC. A button will be used to instantly populate our PC monitor with a webpage of our choosing.

The combination of C and Python allows us to bridge the real world with the software world.

Hardware Connections

LED connected to PB0. Button connected to PD2.

The Software

The code is split across two files:

  1. shoo_away_button.c

Initializes UART and LED. Responsible for detecting a button press.

  1. shoo_away_button.py

Monitors the serial port if a byte has been transmitted. If yes, it launches the webpage.

The Showcase