3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Create an Applescript/Arduino Alert flag.

Create an Applescript/Arduino Alert flag.
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!
 
Remove these adsRemove these ads by Signing Up
 

Step 1What you Need

What you Need
Hardware:

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

A Servo

Wires to connect the Arduino to the Servo. My wires were a bit longer than needful.

Software:

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:
http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/

- Arduino Code

- Run Flag Applescript
« Previous StepDownload PDFView All StepsNext Step »
42 comments
1-40 of 42next »
Jul 24, 2011. 9:14 AMvishalapr says:
when I download runflag it downloads and saves as an unknown file type so what do I need to select to open it?
I tried adobe application installer but it didn't work...so please help!
Jul 24, 2011. 11:32 AMvishalapr says:
ok...so is there any way we can do thisbut on windows XP?
Jul 24, 2011. 9:43 PMvishalapr says:
ok...thanks...
Jul 24, 2011. 9:20 AMvishalapr says:
Is it possible to use this method but for windows XP...hope there is...I would really love any help on this!
Thanks
Mar 19, 2011. 7:55 PMpeter_schlamp says:
Excellent post. This will be my first servo project!
Dec 1, 2010. 8:35 PMsparkyish says:
great write up, thanks a ton. I am very new to this. I am using arduino to control a dc motor, and i wanted to make a voice command script recognized by speech recognition + applescript to run an appropriate forward or backward movement. i had the arduino portion set up and working by entering either an f (for forward) or b (for backward) in the serial monitor of arduino, but after i compiled Tom Kurt's code following your instructions the motor no longer turns. I can send the character f or b through terminal and it successfully makes it through to arduino (proven through a serial.println to the serial monitor), but no turn on the motor.. do I need to setup another serial port?

here is my test terminal command:
./arduino-serial -b9600 -p /dev/tty.usbserial-A700dYg4 -s f

results in: "Running forward" in the serial monitor

and here's my arduino code:

#include

AF_DCMotor motor(2, MOTOR12_1KHZ);

void setup() {
Serial.begin(9600);
motor.setSpeed(255);
}

void loop() {
if (Serial.available() > 0) {
int inByte=Serial.read();
switch (inByte) {
case 'f':
Serial.println("Running forward");
motor.run(FORWARD);
delay(500);
motor.run(RELEASE);
break;
case 'b':
Serial.println("Running backward");
motor.run(BACKWARD);
delay(500);
motor.run(RELEASE);
break;
default:
Serial.println("default value reached");
}
}
}

thanks for your time/advice!
Dec 1, 2010. 8:45 PMsparkyish says:
edit.... and after all that i noticed the ground came unplugged. lucky me for easy solutions! thanks again, haha
Nov 11, 2010. 6:06 AMMansan says:
Hi, cool project, I have been searching a lot for something that does this!

I have this weird problem though, the Arduino only responds properly if the IDE and serial monitor are open, otherwise I just get a quick double blink from the LED. How can this be?

Thanks!

Nov 11, 2010. 6:59 AMMansan says:
Also, I'm using an Arduino Uno.
Oct 5, 2010. 12:36 PMbfarn says:
Just wanted to make your flag pop up.

And to thank you for this project. I'm using it to control a simple status light on an applescript and photoshop-action based photo booth.

Fun!
Jul 28, 2010. 3:36 PManonymouse197 says:
Thanks for a fantastic instructable! Being a bit of a novice I was wondering how I could do away with the servo and flag (as my servo has not yet arrived) and simply light the Arduino LED for a couple of seconds. I originally though that this would simply be as easy as replacing every servo related command with a corresponding LED pin 13 one, but I have got a bit confused with the command line aspect. Please could you give me a hand with the Arduino scripting and command line? Thank you very much for your help and a great instructable, Ari
Jul 29, 2010. 1:56 AManonymouse197 says:
Ah Ha! Its OK, I have figured it out. :)
May 15, 2010. 4:31 PMbobbob says:
 Hello,
I put the file in the correct folders but I get this error:
sh: /Users/drummerboyx/Library/Scripts/arduino-serial.c: Permission denied

Any ideas?
May 19, 2010. 7:18 PMhumphreys7 says:
 How do you compile it?
May 19, 2010. 7:32 PMhumphreys7 says:
never mind, figured it out

and for anyone else who doesn't know how:

 gcc ./arduino-serial.c
Mar 8, 2010. 9:19 AMglocketz says:
 Hey there. Great project. Im having problems downloading the script file and the .pde. They just show up as .tmp files on my desktop. Thoughts?
Mar 8, 2010. 1:38 PMglocketz says:
 thanks for the quick response. everything works great. Im a bit new to avr programming, and im wondering if you can help me. Im using the project for an application that needs the servo to rotate 180deg in the positive direction and stop. then, when receiving a "1" command, rotate again 180deg in the positive direction, etc. Can you help me augment your .pde? 
Jan 17, 2010. 1:14 PMLeandro Tavares says:
Hello, first of all, congratulations for this project!

I tested the terminal part, and it worked, but when I tried the AppleScript part I got an error message: "sh: /Users/leandrolucianitavares/Library/Scripts/arduino-serial: No such file or directory". I created the folder "Scripts" at the Library Folder, and put both the arduino-serial.c and the AppleScript file(which i called LedArduino) into it. I tried everything i could tought to solve it, but it was not effective! Could you help me? 


Thanks,

Leandro Tavares
Jan 17, 2010. 4:42 PMLeandro Tavares says:
 Thanks for your time and the support, I made a mistake when I put the files, I forgot to put the compiled arduino-serial, I only put the arduino-serial.c, it was a dumb mistake!

By the way, I am expanding it for other applications (Adium as an example), but I am using LEDs instead of servos! I am thinking about a push button to turn off the LEDs (representing that the message was received) !

I was looking for a project like this!!
Again, thanks for this!!!

Leandro Tavares
Sep 7, 2009. 10:25 PMmutface says:
files dont download, all i get is .tmp : (
Sep 11, 2009. 9:47 PMmutface says:
thanks! it worked great
Mar 31, 2009. 12:27 PMaethiolas says:
I just wanted to throw the flag up!! Awesome job!
Mar 12, 2009. 11:21 PMmunchman says:
For windows, you could get an outlook rule to trigger the arduino.
Mar 12, 2009. 2:10 PM=SMART= says:
Cool !
Mar 12, 2009. 2:19 AMNachoMahma says:
. Awesome! I don't need that particular implementation, but I can see where this could be adapted for all sorts of useful things. . Would it be possible to leave the flag up until you open the msg? Some other event, eg, mouse click?
Mar 12, 2009. 8:54 AMSwishercutter says:
How about a pirate flag, since most people use their computers as "pirate ships".
Mar 12, 2009. 8:55 AMSwishercutter says:
Make it pop up whenever the bit torrent client is running.
1-40 of 42next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
10
Followers
2
Author:aarone(AaronEiche.com)
I'm Aaron. I've written for Television I"ve written, directed, and performed in a musical I'm a programmer I'm a Roboticist I'm a Dreamer I'm a doer