Hello,
I am working on a project that I am reading PORTB pins 8-11 that is acting as a type of 4-bit password. The accepted 4-bit passwords are stored in an array with 10 acceptable passwords. I am trying to create a program that turns a green LED on when the password is accepted and in the stored array. When a password is rejected a red LED is on. I have my current code below, looking for any suggestions to make a working program.
Thanks for any help in advance!!
boolean Passarr[]={0010,0011,0100,0101,0111,1010,1011,1100,1101,1110};
int greenLED=12;
int redLED=13;
void setup(){
DDRB = B00110000;
}
void loop()
{
PINB=B00001111;
for(int j=0;j<9;j++)
{
if (Passarr[j]=PINB){
digitalWrite(greenLED,HIGH);
digitalWrite(redLED,LOW);
delay(20000);
}
else
{
digitalWrite(greenLED,LOW);
digitalWrite(redLED,HIGH);
}
}
}