Serial output continually looping

Hello, I'm following Ben Eater's 6502 breadboard computer

I'm hooking up the 16 address lines from the 6502 to the Arduino in order to see the values output to the serial monitor

here's my sketch:

const char ADDR[] = {22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52};

void setup() {
  for (int n = 0; n< 16; n += 1) {
    pinMode(ADDR[n], INPUT);
  }
  Serial.begin(57600);
}

void loop() {
  for (int n = 0; n< 16; n += 1) {
    int bit = digitalRead(ADDR[n]) ? 1 : 0;
    Serial.print(bit);
  }
Serial.println();
delay(500);
}

I have the clock for the 6502 paused, so only one value should be output, only one time... but the one value is being output continually over and over again.

perhaps my board is not setup correctly, but I can't figure it out, and could use some assistance please.

-- xed_over (Dennis)

The 6502 clock may be paused but why would that prevent the Arduino reading the value on the 16 pins and printing them ?

1 Like

Oh my goodness... I'm an idiot.
I just needed to watch more of the video... he moved the loop function to an "onClock" function so it outputs only once per clock tick

nevermind on my question
thanks anyway.

of course it would keep outputting... that's what a loop function does
I'm an idiot.... thanks anyway.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.