This is the full working Arduino code, for writing and loading. This shouldn not be used by students.