changed control sequence to accept gpio input