(Processing) Updating displayed information when RFID tag removed from Reader

I am doing a project where I use RFID readers for location. I am using Processing to manage data obtained from the readers.

The problem is that I do not know how to display information "no tag" when the tag is removed from the reader. Right now the name of the tag keeps on being displayed even after the tag is removed - until another tag appears within reader's range.

Can someone please help me solve that issue?

here is my current code:

import processing.serial.*;
Serial myPort1;
Serial myPort2;
String sensorReading1="";
String sensorReading2="";
PFont font;
PImage bg;

void setup() {
  size(2290,1433); 
  bg = loadImage("map.jpg");  
  myPort1 = new Serial(this, "COM4", 9600);
  myPort1.bufferUntil('\n');
    myPort2 = new Serial(this, "COM5", 9600);
  myPort2.bufferUntil('\n');
  font = createFont(PFont.list()[2],52);
  textFont(font);
}

void draw() { 
  background(bg);

  writeText2("Reader2: \t"+sensorReading2);
  writeText1("Reader1: \t"+sensorReading1);
}
  
void serialEvent (Serial myPort){ 
  
  while(myPort.available() >0){
    
    if(myPort == myPort1) {
     sensorReading1 = myPort1.readString();
     sensorReading1 = trim(sensorReading1);
     }
    if(myPort == myPort2) {  
     sensorReading2 = myPort2.readString(); 
     sensorReading2 = trim (sensorReading2);         
    }      
  }
}  

  void writeText1(String textToWrite1){
    fill(204, 102, 0);
    rect(width/20, height/5, 55, 55);
    text(textToWrite1, width/20, height/5);  } 

  void writeText2(String textToWrite2){  
    text(textToWrite2, width/20, height/2); }

Right now the name of the tag keeps on being displayed even after the tag is removed - until another tag appears within reader's range.

Yes that is a function of the reader.
The only way I have seen reported as a work round is to constantly power off the reader and power it back on until you don't read a tag again. You need to switch the power on and off to the reader with a transistor or FET. The speed you can do this depends on the reader. The report I read said they did it at 1 second intervals.

Grumpy_Mike:
Yes that is a function of the reader.
The only way I have seen reported as a work round is to constantly power off the reader and power it back on until you don't read a tag again. You need to switch the power on and off to the reader with a transistor or FET. The speed you can do this depends on the reader. The report I read said they did it at 1 second intervals.

Grumpy_Mike thank you again for answering. In that case I decided to create a "Refresh" button which will re-take the readings when pressed :slight_smile: