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.
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.