That sample rate is pushing it for a 16MHz processor.
uhm, yeah, in fact the only thing that made things better is lowering the samplerate to 10kHz. Still hearing some clicks when the ADC is sampling, tho
Yes because that is 0.1mS of blocking code. To minimise this then set the A/D converter in the free running mode and read it when required.
I also set it in free running mode, no change with the clicks. As far as I understood, even in free running mode, if I decide to sample every X, there will be some blocking code every X. I had a look at the source code for the analogRead() function, there is a very explicit empty while loop waiting for the AD conversion to complete. Is there a different workaround for that?
Anyways, I was using the analogRead() just as a test, might not even want to include it in my project. Now I'll try to add my PS/2 keyboard code and see if it holds up :))
Thanks a lot for the help so far!