Can i send signal to two arduino from one rfid?

Hi everyone. I am work on a project. When the rfid card is read, send the arduino serial monitor to a value of "1". I do this with 1 arduino, on 1 computer. Now I want to send a signal to 2 computers with 1 rfid. I use arduino uno. I don't have an Arduino Due. I think i am must use 2 arduino. I know I can do this by connecting the arduino pins "rx", "tx" but I don't know how to write the code. my code is here:

#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
int mystr=1;
String UID = "CA C7 44 B4";
String UID1 = "1A FE 22 BE";
byte lock = 0;
String UID2 = "6A 73 27 B4";
MFRC522 rfid(SS_PIN, RST_PIN);
void setup()
{
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
}
void loop()
{
if ( ! rfid.PICC_IsNewCardPresent())
return;
if ( ! rfid.PICC_ReadCardSerial())
return;

String ID = "";
for (byte i = 0; i < rfid.uid.size; i++) {

ID.concat(String(rfid.uid.uidByte[i] < 0x10 ? " 0" : " "));
ID.concat(String(rfid.uid.uidByte[i], HEX));
delay(300);

}
ID.toUpperCase();

if (ID.substring(1) == UID ||ID.substring(1) == UID1 ||ID.substring(1) == UID2 ) {

Serial.println(1);

delay(6000);

}
else {
Serial.println("Yanlish kart");

}
}

important part is "serialPrintln(1)". İ dont know what i write this part.
i do repeat i want when rfid == True then Serial.println(1) but i must send two arduino's serial monitor in different computer. please help me.

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Then your serial connection is actually using the USB connection to the PC. There is no way to connect two computers to the same USB. Why fight an unwinnable battle? Just get an Arduino board with multiple serial ports.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.