Skip to content

Instantly share code, notes, and snippets.

@willprice
Created January 7, 2012 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willprice/1575531 to your computer and use it in GitHub Desktop.
Save willprice/1575531 to your computer and use it in GitHub Desktop.
Gmail Checker
// 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