adding david's arduino code