Consolidate RPi and Arduino code