# Video forwarding with Processing - request

**URL:** <https://discourse.processing.org/t/video-forwarding-with-processing-request/16326>\
**Category:** Electronics (Arduino, etc.)\
**Tags:** homework\
**Created:** [December 11, 2019, 5:41pm UTC](https://discourse.processing.org/t/video-forwarding-with-processing-request/16326 "2019-12-11T17:41:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![galgal12345](https://avatars.discourse-cdn.com/v4/letter/g/f9ae1b/32.png) [@galgal12345](https://discourse.processing.org/u/galgal12345)\
**Post date:** [December 11, 2019, 5:41pm UTC](https://discourse.processing.org/t/video-forwarding-with-processing-request/16326/1 "2019-12-11T17:41:12Z")

</div>

Hi guys,  
Im new to Arduino+Processing and I have a project for school.  
can anyone help me with coding this task-  
Im using an infrared sensor with this code on arduino (attached) and I would like to ‘forward’ a playing video (for 2 seconds and back to ‘play’) of mine whenever there’s an obstacle infront of the sensor.

could you help me with the codding of processing? thank you from the bottom of my heart!

Arduino:

```auto
#define IR 8

int Obstacle;

void setup() {
  pinMode(IR, INPUT);
  Serial.begin(9600);
}

void loop() {
  Obstacle = digitalRead(IR);

  if (Obstacle == LOW) {
    Serial.println("STOP");
  }
 else {
   Serial.println("All Clear");

  }
  delay(0);
}

```

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 12, 2019, 2:14am UTC](https://discourse.processing.org/t/video-forwarding-with-processing-request/16326/2 "2019-12-12T02:14:40Z")

</div>

as a first step need to make a Arduino code

-1- that not send 1000 lines per sec as your PC/OS/processing  
might get stuck, but sure you might not be able to follow any printed data.

-2- now while test you might use  
delay(100); // 10 lines per sec  
there could be a complete different approach,  
just send one line on CHANGE ( and not need any delay )  
that would require to have a memory variable "

```auto
int obstacle,obstacleold;
// for check use
if ( obstacleold != obstacle ) Serial.println(obstacle);
obstacleold = obstacle;

```

-3- there is no use in computer communication to send words, you not  
talk to human or a WORD program.  
send a “0” or “1”,  
did you try

```auto
Serial.println(Obstacle);

```

what you see on the Arduino IDE Monitor window.

* * *

for the processing code could follow  
[https://processing.org/reference/libraries/serial/serialEvent\_.html](https://processing.org/reference/libraries/serial/serialEvent_.html)  
or a tutorial…  
[http://kll.engineering-news.org/kllfusion01/articles.php?article\_id=92#example3](http://kll.engineering-news.org/kllfusion01/articles.php?article_id=92#example3)

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 12, 2019, 2:28am UTC](https://discourse.processing.org/t/video-forwarding-with-processing-request/16326/3 "2019-12-12T02:28:27Z")

</div>

Hello,

I was able to make this work with:

[https://processing.org/reference/libraries/video/Movie.html](https://processing.org/reference/libraries/video/Movie.html) (you will have to add library)  
[https://processing.org/reference/libraries/video/Movie\_jump\_.html](https://processing.org/reference/libraries/video/Movie_jump_.html)

And from the Processing examples:

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7a359b0a4677ebc5651b7d08045f3e4dda4989fc.png)

You will have to integrate the code and modify it for your use.

🙂
