I had posted several examples on this forum about paralell and serial port. Depending on your hardware you may use those. On newer projects i've been using usb HID using hidapi library, but requires better hardware. cheapy hardware usually repond to serial port so look for that.