New and trying to figure out code

If your 3 second delay is after the write, the write has already been done, so delay serves NO purpose.
Paul