Recitation 10

Ideas and inspiration

(link for the video)

  I tend to make the process of running change according to a potentiometer.

Arduino

  I used Arduino to read the potentiometer and send the value after using “map” to Processing.

Below is my code:

#include 
int value1;
int value2;

SerialRecord writer(2);


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

void loop() {
  value1 = map(analogRead(A0),0,1023,0,100);
  value2 = map(analogRead(A1),0,1023,0,100);
  writer[0] = value1;
  writer[1] = value2;
  writer.send();
  delay(20);
}
 

Processing

  On the processing, I used two values sent to control the speed of the video and the X position of the video so that it looks like the little man is accelerating while running forward.

this is a video recording of the result:

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *