Jesse Bettencourt, Michael Cannon, and Mackenzie Richardson
Our initial plan was to create an LED strip with various functions to respond to our current computer activity. This multicoloured strip would be attached to the rear of our monitors and would be able to display a large variety of patterns and sequences. For instance, when we received an email the light could break from a neutral rotation and start flashing red.
The open-ended nature of this project would allow us to add as many functions as we wanted. We created a list of ‘modes’ that we thought could be useful. These included a gaming mode that would offer several important indicators about character status, a movie mode that could match the current mood of a film, a Pomodoro mode for productivity benefits, as well as an email mode. We had found several videos demonstrating that gaming and movie mode were possible, so we just needed to find the appropriate APIs. We knew that we were being very ambitious in trying to incorporate so many functions, but this served as a good starting point for our work.
We realized that we needed to create a way for the computer to communicate with the Arduino. This complicated matters because it meant using both Arduino and Python scripts for our project. Thankfully between the three of us we had enough background in these languages to make it work. We used a serial connection to communicate between the computer and Arduino.
The LED strip that we ordered took much longer to arrive than expected. As the end of the course neared we had to compromise and do a proof-of-concept using the RGB LED included in the course kit.
We wrote a program to tell the Arduino to blink when an email had been received. It would break from a ‘neutral mode’ of fading green and blue to blink red several times. The code for this was fairly straightforward. We had a script that could access our gmail accounts and check for new mail. If a new message was found, it would activate an email() function that sent a ‘1’ over serial. The Arduino code was set so that as long as serial != 1 it would be in neutral mode. Receiving the 1 activated a single cycle of the blinking alert. The Python code is found below:
import feedparser, time, serial
ser = serial.Serial(“COM3”, 9600)
serin = ser.read()
while ser.read() == ‘1’:
NEWMAIL_OFFSET = 1 # my unread messages never goes to zero, yours might
MAIL_CHECK_FREQ = 20 # check mail every 60 seconds
previousmailcount=newmails = int(feedparser.parse(“https://” + USERNAME + “:” + PASSWORD +”@mail.google.com/gmail/feed/atom/%5Eiim”)[“feed”][“fullcount”])
newmails = int(feedparser.parse(“https://” + USERNAME + “:” + PASSWORD +”@mail.google.com/gmail/feed/atom/%5Eiim”)[“feed”][“fullcount”])