The code you have posted uses pins 8-11 whereas your comment seems to say you are using pins 2-5. That makes me wonder if you have shown us the example code, or your own actual code. There can be "many a slip twixt cup and lip" so it is important to show your actual code.
Also it would be very useful if you make a clear pencil drawing of how everything is actually connected and post a photo of the drawing.
...R