I am not saying any particular way is superior to the other but to look at all the options and in this application readBytesUntil may well be suitable for the OP or it may not With readBytesUntil the data we have here (21 bytes) can be transferred from buffer to array under ~0.1mS or if we do it without the packet length test ~20.0mS The code for readBytesUntil is easy to read and understand.With a fixed length data packet, as we have in this situation, testing the packet length before a read can make this method as quick if not quicker than other methods. That is why I don't like to dismiss readBytesUntil out of hand. I have read Robins Serial Basics and I think its a must read, and as Robin noted the different possible scenarios of reading and writing serial are almost endless. But I do understand the point you are trying to make. I figured the application was not too time sensitive, good luck with your methods block while reading serial unless its a multi threaded system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |