Hi all,
I have a SMA420564 that I would like to have display the value of 2 variables, readPtr and writPtr. They will always be less than 100 and greater than/equal to zero. I have gotten code to work but it is almost unreadable due to flickering because it sits in loop(). I have written a routine to change the display when certain buttons are pressed but no matter how much I play around with the code I can only ever get a single digit to show the value which is correct. But the other digits go black. I currently have four 1K resistors on the d1 to d4 SMA inputs, 6,8,9,12 to four digital pins 38,39,40,41 (using a Mega). I have the segments on 30 - 37. pickNumber(x) turns on the correct segments in a single digit based on the value of x.
Here is how I am writing to the display:
void updateDispl()
{
digitalWrite(d4, LOW);
pickNumber(1);
digitalWrite(d4, HIGH);
digitalWrite(d3, LOW);
pickNumber(2);
digitalWrite(d3, HIGH);
delay(100);
digitalWrite(d2, LOW);
pickNumber(3);
digitalWrite(d2, HIGH);
delay(100);
digitalWrite(d1, LOW);
pickNumber(4);
digitalWrite(d1, HIGH);
refresh = 0;
}
The refresh variable gets set to 1 when a button is pressed and at the top of the loop() I call updateDisp if refresh = 1.
Couple of questions: When the digit pins (d1-d4) go high do they reset the entire display? I can write by setting them low but then I get the last digit in all four spots if I don't set it back high.
Is my only option to write every time thru the loop()? Any other suggestions???
Thanks in advance!!
joeb