RFID and Video
in
Core Library Questions
•
5 months ago
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:
- import processing.serial.*;
- Serial myPort;
- String inString;
- String RFID1 = "67005DB143C8"; //Card 1 RFID
- String RFID2 = "67005DC651AD"; //Card 2 RFID
- String RFID3 = "2500AC086AEB"; //Card 3 RFID
- PImage jpg;
- boolean sketchFullScreen() {
- return true;
- }
- void setup()
- {
- size(1280, 1024);
- myPort = new Serial(this, Serial.list()[5], 9600);
- myPort.bufferUntil('\n');
- jpg = loadImage("scan.jpg");
- imageMode(CENTER);
- if (frame != null) {
- frame.setResizable(true);
- }
- }
- void draw()
- {
- background(255);
- image(jpg, width/2, height/2);
- if(inString != null){
- fill(150,255);
- }
- }
- void serialEvent (Serial myPort) {
- inString = myPort.readStringUntil('\n');
- if (inString != null) {
- inString = trim(inString); // trim off any whitespace:
- print("RFID = " + inString + " : ");
- if (RFID1.equals(inString) == true){ //checks inString to see if it matches the first RFID
- println("Card 1");
- jpg = loadImage("card1.jpg");
- }
- if (RFID2.equals(inString) == true){ //checks inString to see if it matches the first RFID
- println("Card 2");
- jpg = loadImage("card2.jpg");
- }
- if (RFID3.equals(inString) == true){ //checks inString to see if it matches the first RFID
- println("Card 3");
- jpg = loadImage("card3.jpg");
- }
- }
- }
2