if (val >= 0 && val < 5)
else if (val >= 6 && val <= 10)
else if (val >= 11 && val <= 15) {
Suppose val is 5. What happens?
If val is less than 10, the 1st of second if blocks deal with that situation. The val >= 11 part is unnecessary, because val has to be greater than 10 in order to have gotten by the first two checks. The same holds true for all the other compound if tests, except the first one, where, apparently, the value of 5 is to be explicitly ignored (or not).
Here is the code, if this isn't it I'll assume I looked at a bad datasheet for my shift registers pinoutpinout.
Or you have the LEDs in backwards.