hello, can someone help me? I have connected to bluetooth and it is connected. but error keep showed up. after that, I have change my block and set the receive text equal to -1, but the the data from bluetooth cannot be send to mit app. im using RFID and bluetooth. when bluetooth is available, i have to scan the card. and the bluetooth will print my card id at mit apps. here i attach aia files and coding.
#include "SPI.h"
#include "MFRC522.h"
#define SS_PIN 10
#define RST_PIN 9
String command;
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2);
MFRC522 rfid(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
void setup() {
Serial.begin(115200);
SPI.begin();
rfid.PCD_Init();
mySerial.begin(9600);
//mySerial.println("RFID door lock and bluetooth control");//
}
void loop() {
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())
return;
MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
Serial.println(F("Your tag is not of type MIFARE Classic."));
return;
}
String strID = "";
for (byte i = 0; i < 4; i++) {
strID +=
(rfid.uid.uidByte[i] < 0x10 ? "0" : "") +
String(rfid.uid.uidByte[i], HEX) +
(i != 5 ? ":" : "");
}
strID.toUpperCase();
Serial.print("Tap card key: ");
Serial.println(strID);
delay(1000);
//*****************************************************************************
if (strID.indexOf("79:2C:F5:B3") >= 0) {
mySerial.println("Shopping ID:Shikin123");//
return;
}
//*****************************************************************************
//*****************************************************************************
else {
return;
}
}
Smartshopping.aia (11.7 KB)