Instructables

Step 2: Software: Lets go to the head of the class

Picture of Software: Lets go to the head of the class
Obviously one of the most important parts of this project was the source video. I was lucky enough to find some original recordings of the singing busts from Disneyland on Youtube. You can find the one I used here: "Phantom 4 of 5 Grim Grinning Ghosts". I pulled the video from Youtube and used that for both the video and audio in this project. 

As I said in the introduction I primarily used four pieces of software to run this project (all of which are free) they are:
  1. My programmed Arduino UNO
  2. AutoHotKey (Windows macro program)
  3. AAC Keys (Turns serial input into keystrokes)
  4. VLC (video playback)
I also set my Windows background to black and hid the task bar so nothing displayed when the video was not playing.

Here's the code for the AutoHotKey script:

a::

Run, c:\Program Files\VideoLAN\VLC\vlc.exe -I rc "VIDEO_FILE_NAME"
Sleep, 61000 ; Pause for video to play, prevents triggering multiple times.
Process, close, vlc.exe ; Kill vlc and make sure it stays dead.
Return

As you can see it's pretty simple. When the "a" key is pressed VLC is launched with arguments to hide everything but the video itself. The script waits for the length of the video (61 seconds) then it closes VLC to reset and run again.

The Arduino sketch isn't much more complicated it waits until the photocell is triggered, then sends the "a" key to the computer over USB (which AAC Keys turns into a keystroke) and waits for 61 seconds before it can be triggered again. 

 

/*
  Serial Keyboard

 Used to send keystrokes to a Windows PC running AACKeys.exe which
 turns serial data into keystrokes. Best used in conjunction with
 AutoHotKey.

 Examples and idea based on the work of http://www.arkadian.eu and
 information from http://wwww.ladyada.net

TheNewHobbyist 2010 <http://www.thenewhobbyist.com>

 */

// Initialize variables
const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;

// Set inpout/output and start serial
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
}

// Main code loop
void loop(){
    buttonState = digitalRead(buttonPin);
    if (buttonState == HIGH) {
        digitalWrite(ledPin, HIGH);
        Serial.print("a"); // send key to PC to start video playback
        delay(61000); // ignore input until video ends
    }
    else {
        // turn LED off:
        digitalWrite(ledPin, LOW);
    }
}     

mdegiova3 years ago
How do you download the video from youtube?
Thanks
Videodownload helper or ant video for firefox.
Use the Firefox browser and search the add ons. Lots of downloaders.
TheNewHobbyist (author)  mdegiova3 years ago
Keepvid.com does a pretty good job. You can find other similar services pretty easily on Google.