Trigger an image in interactive installation “sensor input cannot be resolved as a variable”

i understand that you now want

  • print a line after each sensor reading
  • and do the threshold in arduino already.
    so the expected data stream would be like?
0
0
3
0
0
0
2
0

but the code for the multiple sensor in processing
to have the

 if ( myPort.available() > 0) {

3 times i doubt.
it should be one time only and analyze the string.
untested idea:

import processing.serial.*;
import processing.video.*;

Serial myPort;  // Create object from Serial class
int play = 0, val;    // Data received from the serial port (int )
String inData = "";
boolean playing = false;
Movie movie1, movie2, movie3;

void setup() {
  size(1080, 720);
  movie1 = new Movie(this, "transparent.mp4");
  movie2 = new Movie(this, "Mushroom clouds.mp4");
  movie3 = new Movie(this, "Mouth smoke.mp4");
  //speed of animations 
  movie1.speed(1);
  movie1.pause();
  movie2.speed(1);
  movie2.pause();
  movie3.speed(1);
  movie3.pause();

  printArray(Serial.list());             // print serial ports 
  String COM1 = Serial.list()[15];       // port communication //change the 0 to a 1 or 2 etc. to match your port
  myPort = new Serial(this, COM1, 9600);
}

void draw() {
  background(0);
    if ( play == 1 )  image(movie1, 0, 0, 580, 790);
    if ( play == 2 )  image(movie2, 0, 0, 580, 790);
    if ( play == 3 )  image(movie3, 0, 0, 580, 790);
}

void serialEvent(Serial p) { 
  inData = p.readStringUntil('\n');
  if (inData != null) {                                // if the string is not empty, do this
    println(inData);
    inData = inData.trim();
    val = Integer.parseInt(inData);
    if ( val == 0 ) ;  // ignore
    if ( val == 1 ) startM1();
    if ( val == 2 ) startM2();
    if ( val == 3 ) startM3();
  }
} 

void startM1() {
  if (!playing) {
    movie1.play();       // display movie1 
    playing = true;
    play = 1;
  }
}
void startM2() {
  if (!playing) {
    movie2.play();       // display movie2 
    playing = true;
    play = 2;
  }
}
void startM3() {
  if (!playing) {
    movie3.play();       // display movie3
    playing = true;
    play = 3;
  }
}

the logic you want is?
you can start a ( other ) movie only if
playing == false
i not see where you set this??