

I just verified it empirically, nothing much.For other uses, see Serial killer (disambiguation).Īn 1829 illustration of British serial killer William Burke murdering Margery Campbell.Ī serial killer is typically a person who murders three or more people, usually in service of abnormal psychological gratification, with the murders taking place over more than a month and including a significant period of time between them. It makes it a little faster, saving 6-10us (on average). If your code is sending fast enough then that's great. The flush was there so the serial buffer emptied before the next reading was added, preventing full buffer blocking at the possible expense of slightly slower but consistent sampling.

Why do you need to repeat the analogue read and serial send several times in the while loop? val = analogRead(phr) Serial.write( val>5 ) Serial.write( val & 0x1F ) If you're interested about the python program, that takes this data and draw them in a graph in real time (at 63us per sample), just drop me a message I didn't need to use the Serial.flush(), maybe cause I'm reading them fast enough? Val = analogRead(phr) Serial.write( val>5 ) Serial.write( val & 0x1F ) Serial.write( val & 0x1F ) //and then the lowest 5 Serial.write( val>5 ) //write first the highest 5bits Here's my final code: //higher baud doesn't help. Thanks to Riva I'm now able to output a value (ranged between, that is 10bit) in 32micros.

So maybe I just should read faster? I'm going to see and report what I discover. In fact, increasing its dimension (with this trick ) the number of samples increase proportionally to the increase of the buffer dimension. I'm fairly sure that the buffer gets full after those 22 samples. What I want to do is to sample a light, and of course I want the highest frequency as possible because I want to write those data in a graph (made with python). but Serial.println takes 411us after the first 22 call to Serial.println() function analogRead, thanks to the trick above, only takes 6micros following three lines to speed up ADC (that is analogRead() ) Int const btn = 2 //just a button to start the reading Here's the code: unsigned long const baudrate = 115200
