Why is this working WITHOUT the "while" statement? If I touch ANY pin to ground , the dice (display) roll and stop and remain when pin not connected? The button does not even need to be given a pin number and while statement not needed. Trying to get 2 dice to roll on my nano with a TM1637, 4 segment display with a photocell for a button.
No other wiring than four TM1637 pins and ground any other pin on nano.
#include <TM1637.h>
//using nano with button between 8 and ground
//declare pins
int CLK = 2;
int DIO = 3;
int button = A2;
TM1637 tm(CLK, DIO);
void setup() {
pinMode(button, INPUT);
//initialize TM1637 seven segment display;set brightness; 0-7
tm.set(2);
tm.init();
}
void loop() {
// while ( digitalRead(button));
tm.display(0, random(1, 7));
delay(50);
//while ( digitalRead(button));
tm.display(3, random(1, 7));
}
```Thanks again for any help
Greg