100
edits
Changes
→Final Project
== Final Project ==
=== Idea ===
Most people usually check their emails once a day and often times emails, especially messages regarding the day it was sent, are missed. This project proposal attacks this problem that I especially have as well by utilizing the Arduino Board and the easy to write Python programming scripts to make a physical email notifier. I myself have three email accounts that I regularly regard as important email accounts and so I will create three panels with different colored LED lights in them to represent these email accounts. Looks wise I will design them based on Apple's design on their Macbook laptop cover. When one email account receive an email, the LED light will start pulsating.
This project, I realize, will have to use another program that can check emails and talk to Arduino. I have found many tutorials about Python and Arduino on the Arduino website, it seems like Python is like Processing except less on the graphics and more programming. Arduino and Python talk to each other by using Pyserial to talk to the port.
===Illustration and Diagram===
===Photographs of Project===
===Python Code===
===Arduino Code===
/*
Gmail Notifier
This example shows how to fade an LED using the analogWrite() function. It is programmed to talk to Python through PySerial.
Pin 9, 10, and 11 is where the LED's are connected.
Created 1 Nov 2008
By David A. Mellis
Modified 17 June 2009
By Tom Igoe
Further Modified 18 March 2010
By Tiffany Lee
http://arduino.cc/en/Tutorial/Fading
*/
int ledPin1 = 9; // LED connected to digital pin 9
int ledPin2 = 10; // LED 10
int ledPin3 = 11; // LED 11
int mail1 = LOW; // is there new mail? LOW : No
int mail2 = LOW;
int mail3 = LOW;
int val; //Value read from teh serial port
void setup() {
pinMode(ledPin1, OUTPUT); //sets the digital pin as output
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
Serial.begin(57600);
Serial.flush();
}
void loop() {
//Read from serial port
if(Serial.available())
{
val = Serial.read();
Serial.println(val);
//IF ALL EMAILS HAS MAILS
if (val == 'A')
{
mail1 = HIGH;
mail2 = HIGH;
mail3 = HIGH;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin2, fadeValue);
analogWrite(ledPin3, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin2, fadeValue);
analogWrite(ledPin3, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//mail 2 HAS EMAIL
else if ( val == 'B')
{
mail1 = LOW;
mail2 = HIGH ;
mail3 = LOW;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin2, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin2, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//MAIL1 has emails
else if ( val == 'C')
{
mail1 = HIGH;
mail2 = LOW;
mail3= LOW;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//MAIL3 HAS EMAILS
else if ( val == 'D')
{
mail1 = LOW;
mail2 = LOW;
mail3 = HIGH;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin3, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//MAIL 1 and 2 have emails.
else if (val == 'E')
{
mail1 = HIGH;
mail2 = HIGH;
mail3 = LOW;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin2, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin2, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//Emails 3 and 2 have emails.
else if ( val == 'F')
{mail1 = LOW; mail2 = HIGH; mail3 = HIGH;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin2, fadeValue);
analogWrite(ledPin3, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin2, fadeValue);
analogWrite(ledPin3, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
//only emails 1 and 3 have emails.
else if ( val == 'G')
{
mail1 = HIGH;
mail2 = LOW;
mail3= HIGH;
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin1, fadeValue);
analogWrite(ledPin3, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin1, fadeValue); analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(30); } } //actually this isn't used because in Python if there is no emails, the CPU sleeps for 1 second before checking again. else if ( val == 'N') { mail1 = LOW; mail2 = LOW; mail3= LOW; } } }
== Field Research==