Can an I2C device and an [LED or button] share the same pin?

Hello. I've been searching Google and these forums for a while but haven't found an answer. So I'm resorting to posting the question.

I know that multiple I2C devices can share the same pins (A4 and A5) because they have unique addresses. I'm working on a project now using an RTC module on an Uno and it appears that I'm going to be one pin short for what could be either an LED or a button. I'd prefer not to upgrade to a Mega for more pins.

I was wondering if it's possible for an I2C device and a non-I2C device like an LED or a button (which have no unique address) to share a pin and still function properly.

Thank you,

Use SDA - pin: The LED will flash haphazardly while I2C transfers are occurring.
Turn off I2C to read button presses, low = pressed, turn I2C back when you want to do another transfer.

low = pressed

Thank you for the reply CrossRoads.

Quick question: doesn't pressed = high?


I2C lines will have pullup resistor.
Wire button so that it connects to Gnd when pressed.

if (digitalRead(18)== LOW){
// button is pressed