Encoder values keep changing without moving the shaft

Hello, I have a simple Teensy 4.1 code to read 2 optical encoders. This works, but the encoder print out keep changing without moving the shaft. Is there some other sketch in there that is messing this up? How can I erase all of MY previous sketches, without messing up the Teensy internal programming. I have ended up with dead bricks from over enthusiastic cleaning of some of my computers, so I am a little afraid of proceeding too far. I have attached my dec16.ino file for the code
 

Attachments

  • sketch_dec16a.ino
    657 bytes · Views: 18
Aha Amazing! I had the 5V to the encoders coming from my Arduino Leo. which I hooked up to a 13V power supply thru the barrel connector. That seems too much. When I hooked the Leo to the USB of my computer, the encoders work fine. Go figure!!!
 
Back
Top