Added majority of Arduino code