Ok it ended up being some sort of logic error as suspected. The digital pin I was plugging in to must have had 2V logic because that was what was reading on the multimeter. I changed it to a different digital pin and it works fine now. Never knew the AVR had so many different logic levels...