What gets me is it works in one sketch but not the other....
What gets me is that you have not posted either of them