final version from right before class, Arduino code not fully functional