corrected data extraction code for get request
added INOUT mode and way to read back the state of output pin