How to speed up and slow down video using a potentiometer?

Heya

I've made an animation. What I want to do is attach something to the arduinio that allows it to speed up and slow down with a light dependent resister or some kind of potentiometer. Is there somewhere i could be directed to to help me do this, like a diagram and coding?

thanks steph

Tell us more about how you made the annimation?

The generic idea is to read the LDR or potmeter with analogRead() on the arduino which will return a value between 0 and 1023. Send this value over serial line to the PC with Serial.print() and on the PC side you have to read the serial port and adjust the framerate.

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  int speed = analogRead(A0);
  Serial.println(speed);
}

Another option is to read the potmeter and use it as a delay for sending a signal to the PC

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  int ms = analogRead(A0);
  delay(ms);  // waits between 0 and 1023 milliseconds
  Serial.print('N');
}

The PC will move to the next frame when it receives a N

The last one is the most interesting/fun as it can be changed to

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  int ms = analogRead(A0) - 512;
  if (ms > 0 )
  {
    delay(ms);  // waits between 0 and 512 milliseconds
    Serial.print('N');
  }
  if (ms < 0 )
  {
    delay(ms);  // waits between 0 and 512 milliseconds
    Serial.print('P');
  }
}

And the char P is for Previous so you could let the animation run backwards if your animation supports it…(in theory)

Succes

thanks very much for getting back so quick,

The animation is a stop frame, still currently being made, and haven't exported it yet, im guessing to use QuickTime? Will this allow me to play it backwards and forwards, because I quite like this idea. Does this mean I can still speed it up and slow it down, if this is the case, will i need another potmeter?

I am also pretty new to the programming and construction, so as much info as you know on that would be hugely appreciated.

Many thanks again :)

Steph

Will this allow me to play it backwards and forwards,

No it will just send back messages to your Mac (I assume as you are using quick time). You have to have an application on the Mac to do the actual controlling of the video player.

One way would be to use Apple talk to try and control the video player in response to the signals you get from the serial port. To do this you need:- Apple script SerialPort X http://mysite.verizon.net/vzenuoqe/MacSoft.html

im guessing to use QuickTime?

don't know, I know Arduino but not how you make your animation and what player to use. I even assumed you use a PC.

The Latest arduino sketch I posted can be run from the IDE and you will see N's and P's appear faster and slower depending on the potmeter. Test it (and fix it if there errors :)

You must make the application listening to that stream of chars {N+, P+} in your favo language and control the animation player with the incoming chars. That is out the scope of Arduino.

So the big question is what tool will you use to make / play the animation.

OK, I am using a PC so I will try to find the equivalant...

What I have done as a whole, is build a low fi granular synth, and originally wanted to manipulate the video as i manipulated the sounds of the synth, I have more than one arduino so separate programming wouldn't be a problem. Do you know if this is possible? Otherwise how complex is the programming for just speeding up and slowing down the video? Also what should I be playing the video on with a pc?

Again Thank you for your help and Im sorry for all the questions but as I said I am quite new to all this.

Cheers

Steph x

Have been looking into this more and have decided to make the video in flash.

Check - http://arduino.cc/playground/Interfacing/Flash -

Yeah, was just looking at that myself was really helpful. I shall keep you posted with my progress and let you know how i’m getting on.
Cheers for all your help

Steph x

I would bet that Processing can easily allow you to do everything you want. The Video class can play Quicktime movies (probably assuming some common type of encoding) and it can pause, adjust speed, loop, jump to specific time points, and even reverse. Processing also interfaces with serial devices very well.