Fixed issue with bus, added in correct pin numers

I added in the actual pins the in and outputs are connected to
Also fixed an issue where the code would see the fact that it placed
one of the bus pins high as a sign of an external trigger.
Fixed this by adding a variable to keep track of the state of the bus
and only reading out the bus when it is in input mode