Introduction
Direction registers tell the microcontroller if a pin is an input or output. Data registers hold the actual values sent to or read from those pins.
Setting a pin to output so you can turn on an LED.
Reading a button press by setting a pin as input.
Controlling motors by sending signals through output pins.
Checking sensor values connected to input pins.