You get GPIO and any other needed interfaces on any PC, by adding a $10 microcontroller on a USB port, e.g. one of the STM Nucleo boards.
If you use a PC or mini-PC that you already have, that is much cheaper than using a Raspberry Pi or similar.