Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

RFID and Video

$
0
0
Hello,

I am having trouble getting a video to play once a RFID tag is placed on the reader.
I have looked at the references on this site and tried google but I can't anything about getting videos to play.

I have been able to get it to work with images, but I don't know how to get a video to pop up and play once a RFID tag is placed. Could anyone help please?

Here is the code I have got for getting images up with RFID: 

  1. import processing.serial.*;
  2. Serial myPort;  
  3. String inString;

  4. String RFID1 = "67005DB143C8"; //Card 1 RFID
  5. String RFID2 = "67005DC651AD"; //Card 2 RFID
  6. String RFID3 = "2500AC086AEB"; //Card 3 RFID

  7. PImage jpg;

  8. boolean sketchFullScreen() {
  9.   return true;
  10. }

  11. void setup() 
  12. {
  13.   size(1280, 1024); 
  14.   myPort = new Serial(this, Serial.list()[5], 9600);
  15.   myPort.bufferUntil('\n'); 
  16.   jpg = loadImage("scan.jpg");
  17.   imageMode(CENTER);
  18.   if (frame != null) {
  19.     frame.setResizable(true);
  20. }
  21. }

  22. void draw()
  23. {
  24.   background(255);   
  25.   image(jpg, width/2, height/2);
  26.   
  27.   if(inString != null){
  28.     fill(150,255);
  29.   }
  30. }

  31. void serialEvent (Serial myPort) {
  32.   
  33.   inString = myPort.readStringUntil('\n');

  34.   if (inString != null) {    
  35.     inString = trim(inString); // trim off any whitespace:
  36.   print("RFID = " + inString + " : ");
  37.   if (RFID1.equals(inString) == true){  //checks inString to see if it matches the first RFID
  38.    println("Card 1");
  39.    jpg = loadImage("card1.jpg");
  40.   }
  41.   if (RFID2.equals(inString) == true){  //checks inString to see if it matches the first RFID
  42.    println("Card 2");
  43.    jpg = loadImage("card2.jpg");
  44.   }
  45.   if (RFID3.equals(inString) == true){  //checks inString to see if it matches the first RFID
  46.    println("Card 3");
  47.    jpg = loadImage("card3.jpg");
  48.   }  
  49.  }  
  50. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles