KY-040 does not respond // Arduino Dehydrator

Does the example program you mentioned work with your encoder? It's not unusual to get a bad encoder, so make sure it's working first. Also, does your KY-040 have the pullup resistors on the board or not. Sometime you need to use the pinmode() function to set the pullups.