Could somebody tell me why this code doesnt work? I’m sure i connected everything right.
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
SoftwareSerial RFID = SoftwareSerial(13, 10);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//int hacking = 0;
char c;
String msg;
int rfid = 0;
void setup() {
lcd.begin(16, 2);
Serial.begin(9600);
pinMode(A0, OUTPUT);
}
void loop() {
//////////////////////////////////////////////////
while (Serial.available() > 0) {
c = Serial.read();
msg += c;
}
if (msg.length() > 10) {
msg = msg.substring(1, 13);
if (msg == "310047BF3FF6") {
if (rfid == 0) {
rfid == 1;
digitalWrite(A0, HIGH);
lcd.setCursor(0, 0);
lcd.print("1.");
} else if (rfid == 1) {
rfid == 0;
digitalWrite(A0, LOW);
lcd.setCursor(0, 0);
lcd.print("0.");
}
}
msg = "";
delay(300);
}
}