Step 5: Example: Control iTunes with your fuse beads NES
1. Download the following application from Tinker.it to execute Applescript commands that can control iTunes when calling certain characters:
http://tinker.it/now/2007/04/26/control-your-mac-from-arduino-the-easy-way/
(direct link: http://www.tinker.it/files/asproxy02.dmg )
Make sure to choose the right port.
2. Modify the previous Arduino code in the following way in order to send characters to the app when pressing the buttons:
int CrossButton = 3;
int RedButtonL = 5;
int RedButtonR = 8;
int val1 = 1;
int val2 = 1;
int val3 = 1;
int state1 = 1;
int state2 = 1;
int state3 = 1;
void setup() {
pinMode(CrossButton, INPUT);
pinMode(RedButtonL, INPUT);
pinMode(RedButtonR, INPUT);
digitalWrite(CrossButton, HIGH);
digitalWrite(RedButtonL, HIGH);
digitalWrite(RedButtonR, HIGH);
Serial.begin(9600);
}
void loop() {
val1 = digitalRead(CrossButton);
if (val1 != state1 && val1 == 0){Serial.print("C");}
if (val1 != state1){state1 = val1;}
val2 = digitalRead(RedButtonL);
if (val2 != state2 && val2 == 0){Serial.print("B");}
if (val2 != state2){state2 = val2;}
val3 = digitalRead(RedButtonR);
if (val3 != state3 && val3 == 0){Serial.print("A");}
if (val3 != state3){state3 = val3;}
delay(10);
}
3. Use the following commands in the app :
Change track (cross button):
C tell application iTunes
play next track
end tell
Volume up / down for red buttons B and A (see http://bbs.macscripter.net/viewtopic.php?pid=103916 )
A tell application "iTunes"
set currentVolume to sound volume
set sound volume to currentVolume + 10
end tell
B tell application "iTunes"
set currentVolume to sound volume
set sound volume to currentVolume - 10
end tell
Press start in the applescript application.... Done! Now you have a fuse beads NES controller that can control iTunes!
Remove these ads by
Signing Up























Not Nice














Visit Our Store »
Go Pro Today »



