Created
January 7, 2012 18:12
-
-
Save willprice/1575531 to your computer and use it in GitHub Desktop.
Gmail Checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gmail Notifier | |
// Author: Will Price | |
// Date: Jan 2011 | |
// Website: willprice94.blogspot.com | |
// Description: | |
// | |
// A simple sketch that waits for the number of unread messages to come over serial | |
// Use 'gmail_daemon' inconjunction for a physical mail notification system | |
// Macros | |
#include <Servo.h> | |
#define ServoPin 9 // The pin that the servo is connected to | |
// Variables | |
int msgs = 0; // Number of messages unread | |
//Setup Servo | |
Servo myservo; | |
//Initial Setup | |
void setup() { | |
pinMode(ServoPin, OUTPUT); | |
myservo.write(90); // Down position | |
myservo.attach(ServoPin); | |
Serial.begin(9600); | |
} | |
//Loop | |
if (Serial.available() > 0) { // Waiting to read from serial, if the buffer > 0 BYTES then execute code below | |
int msgs = Serial.read(); | |
if (msgs == 1) { | |
myservo.write(0); // Up position | |
} | |
else if (msgs == 0){ | |
myservo.write(90); // Down position | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment