I'm using Atmega328P. I have an encoder wheel with holes and I'm using a VCNT2020 sensor as an encoder to count the rotations of wheel and I am using an LM393DMR2G op amp to filter it so the output waves are square. Everything works great. Now I'm wondering if I can get rid of the LM393DMR2G to save some cost and instead do the filtering in the code? I've heard of others doing this with sensors, so I'm wondering if that may be possible? If so, how? Where can I find out more?