fix error condition check in digitalWrite