Maximum number of connections in an Arduino Uno

I was trying to connect more than one ultrasonic sensor to the same Arduino Uno board. Is that possible, using different digital pins for different sensors?
Also, can the pins 0 and 1 (Rx and Tx) be configured to be input pins, and serve that additional function apart from serial communication? If so, how?
So does that mean you can have upto 18 ultrasonic sensors on the same board (if you configure the analog pins to be input)?

Thanks.

  1. Yes.
  2. Pins can only serve one function at a time. If you have Serial.begin() in setup(), the pins are not free for other IO.
  3. The analog pins are also digital IO pins. A0 to A5 are D14 to D19. I assign them as such as a visual reminder, for example:
byte sensor14 = 14; // or other useful name

pinMode (sensor14, INPUT_PULLUP); // input with internal pullup enabled.