Arduino mega 2560 problem (any URAT device doesn't work)

hi

i have problem in my arduino mega 2560

when i want to connect Fingerprint device or RFiD reader to serial ports (RX & TX)
they didn’t work

i test them with my UNO and they work very well

but when i connect them to my mega and upload the code and open serial monitor there is nothing happed
the fingerprint didn’t turn on and start scanning the finger

i use this code to run finger print in my UNO and it work very well

but with my mega nothing happen

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
int getFingerprintIDez();
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()  
{
  Serial.begin(9600);
  finger.begin(57600);
}

void loop()                    
{
  getFingerprintIDez();
}

int getFingerprintIDez()
{
 uint8_t p = finger.getImage();
 if (p != FINGERPRINT_OK)  return -1;

 p = finger.image2Tz();
if (p != FINGERPRINT_OK)  return -1;

p = finger.fingerFastSearch();
 if (p != FINGERPRINT_OK)  return -1;
  

  switch(finger.fingerID)
  {
   case 0:  
  Serial.println("Haider Ali "); 
    break;
   case 1 :  
  Serial.println("Rida Mohammed "); 
    break;
  }  

  return finger.fingerID; 
  
}

i thought my mega have issue from factory because it’s chines clone :stuck_out_tongue:

but i test it with XBee Pro 60mW Wire Antenna - Series 1 (802.15.4) ,connect it to rx and tx and it work very well i send data from it to another ardunio

but i use SparkFun XBee Explorer Regulated to regulate the voltage either in UNO or mega

what is the problem what do you think
is the mega depends on 3.3v or what :disappointed_relieved:

SoftwareSerial won't work on those pins on a Mega 2560. The RX line must be interrupt capable.

This is from the SoftwareSerial page in the reference.

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

You might want to try converting that to a hardware serial port. There are 4 on the Mega 2560.

thank you relpy

but have Grove Mega Shield V1 form Seeedstudio and it's contain 4 urat port every one with (RX & TX)

like this one

see its photos please

is that mean i can't connect the xbee wireless and RFID Reader, FingerPrint ,arduino to pc port
at the same time using mega 2560

how to convert to the hardware serial port

how to re-define this function

SoftwareSerial mySerial(2, 3);

to make it work on one of hardware serial port in mega 2560

does anyone have an idea how to make this code work with hardware serial in MEGA 2560

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
int getFingerprintIDez();
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()  
{
  Serial.begin(9600);
  mySerial
  finger.begin(57600);
}

void loop()                    
{
  getFingerprintIDez();
}

int getFingerprintIDez()
{
 uint8_t p = finger.getImage();
 if (p != FINGERPRINT_OK)  return -1;

 p = finger.image2Tz();
if (p != FINGERPRINT_OK)  return -1;

p = finger.fingerFastSearch();
 if (p != FINGERPRINT_OK)  return -1;
  

  switch(finger.fingerID)
  {
   case 0:  
  Serial.println("Haider Ali "); 
    break;
   case 1 :  
  Serial.println("Rida Mohammed "); 
    break;
  }  

  return finger.fingerID; 
  
}