simplified some arduino code