Hi there! I'm currently working on a school project that involves a fingerprint sensor. I had the bright idea of having the fingerprint sensor unlock passwords on a 16x2 screen that can be cycled through with a button. I'm using code from another project I worked on that allowed a user to cycle through shortened quick links to websites to create this, so my code has no inclusion of a fingerprint sensor yet.
However, I noticed that the fingerprint sensor module I have needs to be connected to the GND and 5V on the Arduino itself, and my 16x2's potentiometer was there. I followed this guide on having my display function without it. Now, the screen displays nothing when the new code is run, and the button presses just make the screen act weird. I have attached a video of the issue here and have my code below.
#include <LiquidCrystal.h>
int Contrast = 60;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const byte buttonPin1 = 10;
int Counter = 0;
boolean btnState1 = LOW;
boolean lastState1 = LOW;
void setup()
{
Serial.begin(9600);
analogWrite(6,Contrast);
lcd.begin(16, 2);
lcd.print("Locked");
pinMode(buttonPin1, INPUT);
}
void loop()
{
btnState1 = digitalRead(buttonPin1);
if (btnState1 != lastState1)
{
if (btnState1 == HIGH)
{
Counter++;
lcd.clear();
if (Counter > 3)
{
Counter = 1;
}
Serial.println(Counter);
switch (Counter)
{
case 0:
lcd.print("Passwords");
break;
case 1:
lcd.print("Email");
break;
case 2:
lcd.print("Banking");
break;
case 3:
lcd.print("idk porn?");
break;
}
}
lastState1 = btnState1;
}
}