Let's explore how to read a port pin. In the last set of
examples, we focused on writing to a port pin that is set as
an output. How do you think we can read a pin? The answer is
set the port pin as an input and either read the port pin
individually or read the port and mask off the desired bit.
The following schematic shows 2 additional components
needed to read a switch. A 10kohm pullup resistor connecting
RB1 on pin 22 to VCC has been added as well as a push button
switch connecting RB1 to ground.
