Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Trouble Defaulting To Main Page, Please Help

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Thanked 0 Times in 0 Posts

    Default Trouble Defaulting To Main Page, Please Help

    Hi there,
    Java newbie here. I am experimenting with RFID and therefore learning how to give it commands in Java through Processing. I am currently using IF THEN commands and have successfully gotten the reader to switch content based on which chip interacts with it. However, I want the screen to return to a default video when the chip leaves the reader. I have tried a couple things, but the reader seems to be stuck on one chip's content until a new chip is placed on it, where I would like for it to immediately revert to a default screen when the chip is removed until the next chip is placed down. Can anyone see where I need to change this code to get that to happen? Thank you so very much.

    import processing.serial.*;
    Serial myPort;
    String inString = "";

    String RFID1 = "0200B916BC"; //Card 1 RFID
    String RFID2 = "70006D389B"; //Card 2 RFID
    String RFID3 = "010D5E1B7C"; //Card 3 RFID
    String RFID4 = "840034486D"; //Card 3 RFID

    PImage jpg;

    boolean sketchFullScreen() {
    return true;

    void setup() {
    size(1680, 1050);
    myPort = new Serial(this, "COM3", 2400);
    jpg = loadImage("watercolor.jpg");
    if (frame != null) {

    void draw() {
    image(jpg, width/1680, height/1050);

    if (inString != null) {
    fill(150, 255);

    void serialEvent (Serial myPort)
    String rfid = myPort.readStringUntil('\n'); // clean string
    if (rfid == null)
    rfid = "";
    } else
    rfid = trim(rfid);
    // if current tag ignore
    if (inString.equals(rfid))
    return; // exits function
    // new tag
    inString = rfid;
    if (RFID1.equals(inString))
    jpg = loadImage("watercolor_01.jpg");
    } else if (RFID2.equals(inString))
    jpg = loadImage("watercolor_02.jpg");
    } else if (RFID3.equals(inString))
    jpg = loadImage("watercolor_03.jpg");
    } else if (RFID4.equals(inString))
    jpg = loadImage("watercolor_04.jpg");
    } else
    // unknown tag or no tag default
    jpg = loadImage("watercolor.jpg");

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 688 Times in 675 Posts

    Default Re: Trouble Defaulting To Main Page, Please Help

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly per the above link.

Similar Threads

  1. HTML - Main page [Click Logo]
    By Goxy in forum Web Frameworks
    Replies: 3
    Last Post: July 29th, 2014, 11:32 AM
  2. Replies: 2
    Last Post: November 18th, 2012, 01:09 PM
  3. xfa.host.print: print a page + some page range.
    By gammaman in forum Totally Off Topic
    Replies: 2
    Last Post: May 10th, 2012, 08:07 AM
  4. BlueJ trouble or program trouble (Combining Arraylists)
    By star12345645 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 11th, 2012, 12:15 PM
  5. Having trouble printing object information in main class
    By KingLane in forum Object Oriented Programming
    Replies: 1
    Last Post: October 11th, 2009, 06:53 PM

Tags for this Thread