#include <Arduino.h>
void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(9600);
// Set all PORTB pins as output
DDRB = 0xFF;
// Set all PORTD pins as input with pull-up resistors
DDRD = 0x00;
PORTD = 0xFF;
}
void loop() {
// Read the input from PORTD
uint8_t portd_value = PIND;
// Shift right by 2 bits
portd_value = portd_value >> 2;
// Print the value to the serial monitor
Serial.println(portd_value);
// Output the value to PORTB
PORTB = portd_value;
// Wait for a second before the next loop iteration
delay(10);
}