detecting if an arduino is connected before attempting to call write II