re-organized and added arduino code