Using Processing + Makey Makey + Conductive Paint to play a video when an object is touched

edited February 2017 in Library Questions

Hello all,

I am very new to Processing so would appreciate your help.

I have 4 objects painted with BARE conductive electric paint. I have 4 short video clips for each object. Each object has its own video clip. I need a video clip to play when an object is being continuously touched, and for it to pause when the hand is taken off the object.

I have connected a Makey Makey + Alligator clips to the conductive painted objects and also the space bar on the makey makey board. I used the paint on the table surface, so when touching this and the painted object the cursor space is moving in a text doc (just to test).

One of my videos is called M1.mov

The code I have at the moment is but I don't know if it is any good?

import processing.video.*; Movie M1;

void setup() { size(640, 360); background(255); M1 = new Movie(this, "M1.mov"); }

void draw() { background(0); }

void keyPressed() {

if (key == 'r') { image(M1, 0, 0); println("r"); } }

void movieEvent(Movie m) { m.read(); }

Many thanks to all who can help, Vara

Answers

  • Please edit your post and format your code. Select your code and press ctrl+o and have an empty line above and below your code.

    You need to call M1.play() or M1.loop() in setup for the movie to play. However this does not do what you want. The following does.

    Kf

    import processing.video.*; 
    Movie M1;
    
    boolean show=false;
    
    void setup() { 
      size(640, 360); 
      background(255); 
      M1 = new Movie(this, "transit.mov");
      M1.loop();
      M1.pause();
    
    }
    
    void draw() { 
      background(0);
      if(show==true) image(M1, 0, 0);
    }
    
    void keyPressed() {
    
      if (key == 'r') { 
        M1.play();
        show=true;
      }
    
    }
    void keyReleased(){
      M1.pause();   
      show=false;
    }
    
    void movieEvent(Movie m) { 
      m.read();
    }
    
  • Thanks kfrajer

    I get the following error:

    2017-02-24 20:10:59.991 java[13518:2017315] 20:10:59.991 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.

  • This seems very complex?

    If I could test with one object just to start off the with, it would be great. So i touch the object and .mov file starts playing the video.

    Actions ( I hope to achieve)

    One end of Aligator clips is attached to object and the other on earth on the makey makey. I touch my hand on conductive paint on table and touch object and movie starts playing.

    Need help with code aspect of this please

    Thanks

  • please don't post duplicates. i have deleted the other.

  • edited February 2017

    @vvara19 --

    I need a video clip to play when an object is being continuously touched, and for it to pause when the hand is taken off the object.

    The key thing to understand is this (from the Makey Makey website):

    Makey Makey sends the computer a keyboard message. The computer just thinks Makey Makey is a regular keyboard (or mouse).

    So you need a sketch that, when you press a key it plays a video clip (if it is not already running).

    When you release a key, it pauses the clip.

    (This is the design of @kfrajer 's example above.)

    Once you have this working for one clip, do this with different key values for multiple clips.

    There are working examples in Processing Examples that show you how to work with video. Look under Examples > Libraries > Video > Movie

    If the video library isn't working for you at all, even with just testing the pre-installed Examples, you may need to solve this issue first.

Sign In or Register to comment.