got this code working and wanted to add a system of ID numbers that depending on the pattern will send out a different notification. The objective is to be able to enter an ID of 5 numbers with the 6th number symbolizing the type of alert the person wants to send. I keep getting this error- Compilation error: lvalue required as left operand of assignment- and is not sure how to deal with it. thank you for your time.
#include <Keypad.h>
#include <LiquidCrystal.h>
const int RS = 11, EN = 12, D4 = 2, D5 = 3, D6 = 4, D7 = 5;
LiquidCrystal lcd( RS, EN, D4, D5, D6, D7);
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
char keys[4][3] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte rowPins[4] = {13, A0, A1, A2}; //connect to the row pinouts of the keypad
byte colPins[3] = {A3, A4, A5}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
const byte bufLen = 6;
byte index = 0;
char buf[bufLen + 1] = "";
void setup(void) {
Serial.begin(115200);
lcd.begin(16, 2); // Initialize the LCD
lcd.setCursor(0, 0);
lcd.print("Press a key:");
}
void loop(void) {
evaluateKey(keypad.getKey());
}
void evaluateKey(char aKey) {
if (!aKey) { // If no key pressed return immediately
return;
}
switch (aKey) {
case '*' : // Clear second line and key buffer
resetBuffer();
break;
case '#' : // Revert sequence in buffer
;
break;
default: // add all other keys to sequence in buffer until buffer full
addToBuffer(aKey);
break;
}
}
void printBuffer() {
lcd.setCursor(0, 1); // set cursor to second line
lcd.print(buf); // print buffer content
}
//make 2 statements like this code; if code is [] retry, if code is [] activated
void addToBuffer(char newKey) { // add newKey to buffer
if (index < bufLen) { // but only if index is less than the available buffer size for keys
buf[index] = newKey; // Store in buffer at "index"
buf[index + 1] = 0x00; // Store a zero in the following char so that print knows where the string ends
index++; // Increment index
printBuffer(); // print the updated buffer
} else {
lcd.setCursor(0, 0); // set cursor to second line
lcd.print(""); // Print sufficient white spaces to clear the line
}
}
void resetBuffer() { // Resetting buffer and clear the second line
index = 0; // Resetting the index is sufficient
lcd.setCursor(0, 0);
lcd.print("Enter Code:");
lcd.setCursor(0, 1); // set cursor to second line
lcd.print(" "); // Print sufficient white spaces to clear the line
}
//void invertBuffer() { // Invert the sequence of characters in the buffer
//int half; // A variable to guide us halfway through the buffer
//if (index > 1) { // Inverting makes only sense if there is more than one character
//half = index / 2;
//for (int i = 0; i < half; i++) {
//char c = buf[i];
//buf[i] = buf[index - 1 - i];
//buf[index - 1 - i] = c;
//}
//printBuffer();
//}
//}
//int array3[6] = {285353, 409563, 672693, 376583, 294873,0}
//int array2[6] = {285352, 409562, 672692, 376582, 294872,0}
//int array1[6] = {285351, 409561, 672691, 376581, 294871,0}
void IDresponce(){
int array4[6] = {285354, 409564, 672694, 376584, 294874,0};
if (lcd.print("") = array4) {
evaluateKey(keypad.getKey());
(mySerial.available()){
Serial.println(mySerial.readString()); // send from serial to bluetooth
}
(Serial.available()){
mySerial.println(Serial.readString()); // send from bluetooth to serial
}
else {
lcd.print("try again")
}
}