Mini Assignment 5: Processing + Arduino

Delanie Ricketts
3 min readMar 19, 2017

--

After downloading arduino and processing software, we downloaded firmata and uploaded it to the arduino in order to allow it to work in processing. We then connected a potentiometer to the arduino (shown below).

We then tested a video play/pause template using processing. I edited this template to play/pause my own video, which is a concept video for project two.

My edited play/pause code on the left, with the template code on the right.

I had some issues with getting the video to load. I eventually found success by copying the 640x360 resolution — efforts to load a full 1920x1080 video failed. I also used handbrake to compress the video as well so that it was below 1,000kb in size. Below is a video demoing the edited play/pause template. Turning the potentiometer right results in pausing the video while turning it left plays it again.

A video demo of the play/pause template edits I made.

After getting the initial template to work with my own video, I ventured to try to use the potentiometer to adjust a different function— speed. To do so, I looked up the processing video library to see how I could use the speed function to manipulate my video. First I tried bringing the direct input from the potentiometer as the speed. As you can see from the video below, the video is jumpy even without manual input. Essentially, the raw input from the potentiometer was too varied to provide a consistent speed as is. I printed the f value to see how much it fluctuated (seen in the console below the code).

The first iteration of my speed code, using the f value from the potetiometer directly as the speed for the video.

In order to keep the video playing at a stable rate, even as someone manipulates the potentiometer, I created a speed variable that rounds the potetiometer input to a more consistent, stable speed. For instance, any potentiometer input below 0.5 results in a speed of 0.25 (rather than the entire gamut of values below 0.5) while a speed greater than 1 rounds to the nearest integer.

My speed code, based on the original play/pause processing template.

The video below shows this modification in action, with more reliable speeds providing more consistent control of the video. I printed the speed variable to see how much more consistent it became, which you can view in the video in the console below the code. Despite the gains in greater speed consistency, the video doesn’t loop seamlessly because it starts from silence, so whenever the video loops the speed appears to be off until the sound returns again. Nevertheless, this solution provides a more effective solution to controlling the speed of the video.

My final speed video demo.

--

--