#include <avr/io.h>
#include <avr/interrupt.h>
// This sketch reads Nano pins D8 to D13 and mirrors them onto pins A0 to A5.
// The pin states are copied *almost* every 2nd clock cycle. I have seen it
// reproduce pulses as short as 125ns.
// This might possibly be fast enough to mirror WS2812B protocol between pins.
int main(void) {
cli(); // disable interrupts
// set PC0-PC5 as ouputs (Nano pins A0 to A5)
DDRC |= (1 << DDC0) | (1 << DDC1) | (1 << DDC2) | (1 << DDC3) | (1 << DDC4) | (1 << DDC5);
// set PB0-PB5 as inputs (Nano pins D8 to D13)
DDRB &= ~((1 << DDB0) | (1 << DDB1) | (1 << DDB2) | (1 << DDB3) | (1 << DDB4) | (1 << DDB5));
while (1) {
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
PORTC = PINB;
}
}