int clockState = LOW;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(0, OUTPUT);
pinMode(A5, OUTPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int x1 = digitalRead(3);
int x2 = digitalRead(4);
int x3 = digitalRead(5);
int x4 = digitalRead(6);
if(clockState==HIGH){int decimalValue = 8 * x4 + 4 * x3 + 2 * x2 + 1 *x1;
Serial.println(decimalValue);
Serial.println();}
clockState = (clockState == LOW) ? HIGH : LOW;
// Output the clock state on the clockPin
digitalWrite(A5, clockState);
digitalWrite(0, LOW);
// Add a delay to control the clock frequency
delay(1000);
}
ERC Warnings
flop1:CLK: Clock driven by combinatorial logic
flop2:CLK: Clock driven by combinatorial logic
flop3:CLK: Clock driven by combinatorial logic
flop4:CLK: Clock driven by combinatorial logic