Fuse Beads NES Controller

 by Lalya
Featured

Step 5: Example: Control iTunes with your fuse beads NES

DSCN2850.jpg
Here is an example of application for the controller: a "remote controller" for iTunes. You can change track and volume (for Mac only) using Applescript commands sent through Arduino.

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 adsRemove these ads by Signing Up
xUNMERITEDx says: Aug 10, 2010. 4:03 AM
Rawrrrr<3 Please, don't stop talkin' dirty! ^. ^'' Like your skills =D Have a great day! -Michel Merx.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!