Problem with keyboard.h!

Have you tried printing the values returned by analogRead to see if they're what you expect?
I wouldn't use == in this case; better you use a range.

Analogue readings are notoriously noisy.