Arduino:
For the Arduino, to create an input, I used a potentiometer and hooked it up to as an analog input. It wasn’t challenging to due this we’ve done this before in previous classes. Here is what the Arduino looked like:
The code used for the Arduino was the example Serial input a single value, which would be the value from the potentiometer.
Processing:
In Processing, we used Movie library to get a video to display in Processing. I used a video from my phone which was a video of my friend trying to ride a bike. Then, I used Serial receive single input to get the input from the potentiometer from the Arduino. At the beginning I tried to use the input to change which part of the video is played but I struggled with making this work. Instead, I changed it to changing the speed of the video, which was successful. This is the code in Processing:
import processing.serial.*;
import osteele.processing.SerialRecord.*;
import processing.video.*;
Movie myMovie;
Serial serialPort;
SerialRecord serialRecord;
int value;
void setup() {
size(612, 788);
myMovie = new Movie(this, "bran.mov");
myMovie.loop();
String serialPortName = SerialUtils.findArduinoPort();
serialPort = new Serial(this, serialPortName, 9600);
serialRecord = new SerialRecord(this, serialPort, 1);
}
void movieEvent(Movie movie) {
myMovie.read();
}
void draw() {
image(myMovie, 0, 0);
serialRecord.read();
int value = serialRecord.get();
float newSpeed = map(value, 0, width, 0.1, 5);
myMovie.speed(newSpeed);
}
This was the output:
I learned how to change the different properties of a video in this recitation. However, I wouldn’t be using this in my final project.