Hi
I wanna link a arduino to another arduino.
Here's my plan.
If RFID read valid card then transport the signal to another arduino.
then the second arduino turn the LED lights.
and my code is
**Num.1 Arduino
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc(SS_PIN, RST_PIN);
char c;
void setup()
{
Serial.begin(9600);
SPI.begin();
mfrc.PCD_Init();
}
void loop()
{
if(!mfrc.PICC_IsNewCardPresent() || !mfrc.PICC_ReadCardSerial())
{
delay(500);
return;
}
if(mfrc.uid.uidByte[0] == 123 && mfrc.uid.uidByte[1] == 203 && mfrc.uid.uidByte[2] == 7 && mfrc.uid.uidByte[3] == 34)
{
Serial.write('a');
delay(1000);
}
}
**Num2 Arduino Code
void setup()
{
Serial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop()
{
if(Serial.available())
{
char data = (char)Serial.read();
}
if(data == 'a')
{
digitalWrite(LED, HIGH);
Serial.println("Valid Card detected");
}
}
I used that code but it didn't work!
what is problem? plz lemme know. 8ㅅ8