Refactor Arduino and add sr argument to constructor to enable testing.
Add pure-python tests.