Hello
I have a problem with sending out data from arduino to controller. Without mySensors everything is working, but when I try to introduce mySensors syntax everything just stops
#define MY_GATEWAY_SERIAL
#include <MySensors.h>
#include <SPI.h>
#include <MFRC522.h>
#define CHILD_ID_USER 20
#define SS_PIN 53
#define RST_PIN 5
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
const byte michal[] = {0xD4,0x9E,0x17,0xA3};
const byte martyna[] = {0x16,0xCF,0x8F,0x12};
MyMessage msgUSER(CHILD_ID_USER, V_TEXT);
void setup() {
Serial.begin(115200);
SPI.begin();
rfid.PCD_Init();
}
void presentation()
{
sendSketchInfo("USER", "1.1");
present(CHILD_ID_USER, S_INFO);
}
void loop() {
// Look for new cards
if ( ! rfid.PICC_IsNewCardPresent())
return;
// Verify if the NUID has been readed
if ( ! rfid.PICC_ReadCardSerial())
return;
if (rfid.uid.uidByte[0] == michal[0] ||
rfid.uid.uidByte[1] == michal[1] ||
rfid.uid.uidByte[2] == michal[2] ||
rfid.uid.uidByte[3] == michal[3] )
{
Serial.println("User: Michal");
send(msgUSER.set("Michal"),1);
delay(1500);
}
else if (rfid.uid.uidByte[0] == martyna[0] ||
rfid.uid.uidByte[1] == martyna[1] ||
rfid.uid.uidByte[2] == martyna[2] ||
rfid.uid.uidByte[3] == martyna[3] )
{
Serial.println("User: Martyna");
send(msgUSER.set("Martyna"),1);
delay(1500);
}
else
{
Serial.println("Niepoprawna karta!!!");
send(msgUSER.set("Obcy"),1);
delay(2000);
}
// Halt PICC
rfid.PICC_HaltA();
// Stop encryption on PCD
rfid.PCD_StopCrypto1();
}
Meybe someone can see the error in my implementation?