Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to control an app on OSX with an Arduino Uno. Specifically, I would like to start and stop play of an MP3 on iTunes, or a track on Spotify, using an Arduino connected to the Apple computer with USB.

Any suggestions would be greatly appreciated.

share|improve this question
    
This sounds more like an OSX question than an Arduino one. If the things you want to do can be done by a keyboard, you can get a Leonardo type board and be a keyboard. Otherwise you will probably need custom software on the Mac which takes custom messages from the Arduino and turns them into actions. The hard part will be coming up with the Mac side - since it is custom, the Arduino side can be trivial, for example just Serial.println("pause itunes"); – Chris Stratton Aug 7 at 5:43
    
You could write a small script that interfaces through serial to the Arduino and forwards commands and instructions on to other places using AppleScript. – Majenko Aug 7 at 9:58
    
@Majenko that is exactly what I'd like to do. But how? I suppose I should ask the question on 'Ask Different'? – Fed Aug 7 at 12:04
    
90% of what you are wanting to do would be Apple programming. Not something we know much about here. – Majenko Aug 7 at 12:05
1  
Thanks. I'll post in 'Ask Different' – Fed Aug 7 at 12:09
up vote 0 down vote accepted

I am now having Screen output to log.txt, and the following applescript works just great!

set trigger to 1

set stopString to ""

repeat until (stopString = "stop")

set testTxt to paragraphs of (read POSIX file "/Users/fed/log.txt") set countTxt to (count of testTxt) - 1 set lastLine to item countTxt of testTxt
if lastLine contains "Start MP3" and trigger is 1 then tell application "Spotify" to playpause set trigger to 0 end if

if lastLine does not contain "Start MP3" then set trigger to 1 end if

if lastLine contains "Stop Loop" then set stopString to "stop" end if end repeat

share|improve this answer
    
Applescript can read stuff from a .txt file, and cause an event on a specific word? Then you'll indeed only need a program that takes serial input (USB COM-port) and put it in a file. – Paul Sep 11 at 18:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.