what you are going to need to do is "poll" the pins. This can be done in multiple ways, but if you want the simplest, just go with a while loop that reads data from those pins, then calls/does something when you recieve certain results.