Can Anyone Help Me Understand What I am Doing Wrong?

If you have problems with modified code, post the full code. I only gave you loop(), I left the rest to you; so you need setup() and the variable declarations.