A Algorithm Example Code For Arduino