LapTopControllUsingArduino

Can anyone please tell me if/how it's possible to use Arduino to select/access quicktime files on my laptop? Basically I have four objects with sensors and I wish to have a quicktime movie play when one of the sensors is activated! I'm afraid I have no idea how difficult this may be!! :slight_smile: Thanks, GoatBoy

If you can set up some kind of 'keyboard shortcuts' for the files then you can get the arduino to imitate a HID device and do those shortcuts when a sensor is activated...

I would have thought that the arduino is not the greatest platform to be using for this project but I'm sure it's doable...

Mowcius

Thanks Mowcius :slight_smile: Not sure if I could manage setting up the shortcuts to be honest as I'm not sure what's involved there but would it be better to use something like Max/Msp? possibly? :slight_smile:

Maybe, I have had no experience with that...

I have not done any imitating of HID devices with my arduino so maybe someone else knows more about that side of things...

You could use something like this to 'press keys':
http://www.u-hid.com/index.php?option=com_content&view=article&id=2&Itemid=4
but there's probably an easier way to do it...

Mowcius

:slight_smile: Thanks Mowcius, I'll check that out!

might be better to think about the PC being in charge and the arduino just reporting its sensor status. You could have a program running on the pc in processing, vb, or whatever checking for sensor changes and dispatching your windows stuff.

I recently saw something called "gobetwino" that might do what you want too. http://blog.makezine.com/archive/2009/03/gobetwino_links_arduino_to_windows.html

That should be easy, write a program(for the computer) to revive serial input from the arduino with information, and do whatever, Like executing quicktime with the video that you want to play as an argument.
As for the arduino side, when something is detected, send something over the serial port to be revived on the computer.

AutoHotKey can be of some help here too. www.autohotkey.com

Autohotkey is a very simple, yet powerful windows scripting language.

I just tried the following and it does what you need.

  1. Arduino Sketch (your arduino sketch will probably have 4 buttons instead of 1 of the example):
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  Serial.begin(9600); 
  pinMode(ledPin, OUTPUT);      
  pinMode(buttonPin, INPUT);     
}

void loop(){
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {     
    digitalWrite(ledPin, HIGH);  
    Serial.print("A");
    delay(2000);
  }  
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
}
  1. Serial to keyboard: You need something to convert the serial characters to keyboard characters. You can use the AAC keyboard (available both for windows and mac), which is free and available here:
    http://www.aacinstitute.org/Resources/ProductsandServices/AACKeys/AACKeys.html.

AAC needs to be activated, and configured with the right baud rate and port number.

  1. Autohotkey script
    Then a simple autohotkey would look like this:
a:: 
Run "C:\Program Files\QuickTime\QuickTimePlayer.exe" "C:\your video path\Video_A.avi"
return

b:: 
Run "C:\Program Files\QuickTime\QuickTimePlayer.exe" "C:\your video path\Video_B.avi"
return

c:: 
Run "C:\Program Files\QuickTime\QuickTimePlayer.exe" "C:\your video path\Video_C.avi"
return

d:: 
Run "C:\Program Files\QuickTime\QuickTimePlayer.exe" "C:\your video path\Video_D.avi"
return

I hope this helps. :slight_smile:

Thanks everyone!!!!!!!! :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Hello arkadian! Do you know how the arduino code you have here may work with quartz composer? Rather than implement midi which I believe QC handles I wonder if it will take serial print commands! :slight_smile:

This is a really cool program, the AACkeys is awesome! But I'm curious, are there commands you can send via serial port that emulate the control or alt keys? I did see the enter, but haven't found an alt or ctrl.

This opens up SO many ideas that require so much less work! :smiley: :sunglasses:

GoatBoy, Regarding the QC: I'm not a mac user, but my understanding is that it is possible, as long as
A. you can convert arduino serial commands to keystrokes, and
B. you can create keyboard shortcuts for the tasks you need.

CaptainObvious:I love ACC Keys too :slight_smile:
Regarding the Alt+Ctrl+Del, I had a similar situation a few months ago, where I was basically trying to log in to a computer at 8am in the morning and I had to press the Alt+Ctrl+Del and send my login and password. After spending a lot of time, I gave up and got a Xkeys adaptor, which is basically a custom keyboard on a pcb. This is the post of what I did: Arkadian.eu | My arduino clock….

I hope this helps! :slight_smile:

That's fantastic Arkadian and CaptainObvious! I'll look at all that now!!! :slight_smile:
:slight_smile: :slight_smile: :slight_smile: :slight_smile: :)Thanks too much!!!!