Create an Applescript/Arduino Alert flag. using arduino
Have you ever felt like the mail sound on your Mac just wasn’t enough? Simple sounds and alerts just don’t cut it for you? You want something more apparent and rewarding? If so, this is the Instructable you’ve been looking for.
In this Instructable, I’ll show you how to hook up your Arduino to your Mac and throw up an actual flag when the alert of your choice occurs. In our example, we’ll be doing an email alert, but you can use AppleScript to call this when almost anything happens.
I’ve created a little Instructables flag to go off when I receive comments on my instructables.
Let’s get started!
Step 1: What you Need
An Arduino: I know at least that the Duemilanove and the Diecimila will work. I don’t know if older board versions will work.
A Flag: I made an instructables flag to alert me when I get instructables comment.
A 47 Ohm resistor: This is to prevent the Arduino from resetting at the close of a serial connection
Wires to connect the Arduino to the Servo. My wires were a bit longer than needful.
Tod Kurt’s Arduino Serial C code. Tod put this code up which makes it tremendously easy to communicate with the Arduino. Files included here. For more info look here:
– Arduino Code
– Run Flag Applescript
Step 2: Setup the Arduino
We need to get the physical side of this equation set up first.
Out of the Servo, There are 3 wires: Voltage, Ground, and Control. In this setup, we’re plugging those into 5v, Ground and Pin 9.
Also, we’re going to put a 47ohm resistor into the 3v3 pin and the reset pin. This will prevent the arduino from resetting every time there’s a serial connection closed. This was a real pain for me to deal with early on, I’d written the software to handle the reset with a delay, but it wasn’t ever working the way I wanted it to. Resistor solves that problem easily.
Note: According to the source I got this from, the Resistor causes an excessive 20mA current in the Arduino when the reset button is pressed. The person who tested it said it’s outside of specifications, but still worked. Avoid resetting the Arduino when you have the Resistor is connected.
Load the included software onto the Arduino. Make changes as you see fit. Essentially, you’re sending a 0 or a 1 to the arduino, and it’s going to turn the flag up or down based on that.
For more detail: Create an Applescript/Arduino Alert flag.