working code for arduino motor switching and limit switch sensing