refactoring arduino detection methods