I want to debug the signal my input pin is receiving. Its on a vehicle so I figured rather than trying to attach an oscilloscope to it, I'd just send its state via serial line.
The hiccup I'm facing is that there doesn't seem to be any good way to send a bit stream of samples. I resorted to using a stream of bytes for each sample using a line of code like
But the problem here is that at a baud rate of 115_200, my limit is really only a sample rate of about 14,000hz and after adding other lines of code, I can't get above 8000hz. If you don't add a waitcnt() in that loop, it will call the command too frequently and crash.
So is there any way to send a bit stream of the state of the pin? Basically if I had a sample rate of 1,000hz, I'd need my variable to hold bits with each next bit representing the state of the pin every next millisecond: 0,0,0,0,1,1,1,1 being samples at 1,2,3,4,5,6,7,8 ms.