I have been working on a project that uses a lot of sensors, LEDs and other modules. However, due to limitations in size and budget, the only board I can use is Arduino Uno R3, meaning that the I/O pins are not enough.
In response to the issue, I came up with the idea to connect a button and LED in series to one pin (pin x) and switch between pinMode(x, INPUT) and pinMode(x, OUTPUT) when in need of controlling the LED or reading from the button.
I would like to know if it will cause any damage to my hardware (sensors, board, LEDs...), will it be feasible or are there better options to solve my problem.