Using a DEV-17712 with a N.O. push button to A5. When the push button goes low I would like it to clear the COM-16916 Alphanumeric display. Tried every coding I can think of with no luck can you give me any help? Thanks
Does it work if you choose any other analog pin?
Move to another input and changed the code still no luck
Have your code send 4 spaces to the display whenever you press the button?
my 1st attempt was:
previousButtonState = digitalRead(PA7);
if (previousButtonState == LOW)
{
display.write(0x76); // Clear display command
display.updateDisplay();
delay(10);
did not work. 2nd attempt was:
previousButtonState = digitalRead(PA7);
if (previousButtonState == LOW)
{
display.printChar(‘0’, 0);
display.printChar(‘0’, 1);
display.printChar(‘0’, 2);
display.printChar(‘0’, 3);
display.updateDisplay();
delay(10);
What I thinking here was to place all zero on the display to overwrite the buffer but after the display showed all zeros it would display the previous count number was on the alphanumeric display.
next attempt was to restart the wire command to clear the display:
previousButtonState = digitalRead(PA7);
if (previousButtonState == LOW)
{
Wire.begin(); //Join I2C bus
display.begin();
display.updateDisplay();
delay(10);
This did not work, now I thinking about sending a digital code
If you know of easy way to reset the counts to zero the drinks at the bar are on me
That means your other non-button code is still looping, put the button code earlier in the program so that anything in the display variables comes AFTER the code has looped through whether the button has been pressed
You can also turn it off and on again in code SparkFun Qwiic Alphanumeric Display Hookup Guide - SparkFun Learn