Week Twelve: Interface Programming

Wrote a small program to interface with input- and output-devices

Background

This week our assignment was to write a GUI to work with our input/output devices.

Design

My final project will not be using any interface programming (the only UI will be the button that is pushed), so I used an old PCB I made from Embedded Programming week. As a reminder, here is the PCB:

_config.yml

Trace

Cut

Code

The C embedded code today is very simple; it accepts the serial character ‘y’ as a command to turn the LED on, and ‘n’ as a command to turn it off. Additionally, every time the button is pressed or the LED status changes, the button status is transmitted via the serial connection: ‘1’ for on and ‘0’ for off.

Here’s the Embedded C code

Here’s the makefile

For the host code, I chose Python and Tkinter; It’s a fairly simple way to create easy GUI interfaces. Basically I open the serial connection and I have buttons to send ‘y’ or ‘n’ to turn the LED on or off, respectively. In addition, I listen for the connection. A cool on/off graphic changes on the screen when the button is pushed.

Here’s the Python code

And here are the On and Off images.

Here’s how the interface looks:

_config.yml

And here’s a video of everything together:

Yay.

Written on November 27, 2016