Optical encoder too output moter adafruit motor sheld help

Hey guys thanks for taking the time I am a bit new to this and have a slight vision problem nothing like a challenge anyway Ive take some shots to show my poor color codding and wiring lol normal would be neater but for now it is what it is anyways. pins 5-6 red n black wire is the output from the optical encoder orange and purple wire is just 3vlts supplying power to the encoder. I get output signals from encoder in first code i provided but not in second i think it still works in second one but just will not show in the serial monitor application that Ive just discovered how cool and handy .
I will be using a nema 17 stepper but i am waiting for this to arrive also using a multi-meter works fine for testing. also this old Epson stepper Ive got and runs on motor test fine .
also Power jumper is in off position in photo and external PSU wasn't connected i normally connect a 12vlt 3amp PSU just slapped it together for some pics