PDA

View Full Version : Choosing and creating simple checksums



ausserirdischegesund
02-27-2013, 07:27 AM
I've connected some sensors to a few Teensies, and while it works fine, I want to have one additional layer of plausibility checking by introducing a checksum.

What I've got now looks like

23.0 57.6 1024.0 784

on a line-by line basis. What I want is to have a checksum per line

23.0 57.6 1024.0 784 68

where 68 is calculated from the other numbers (or a hex number, string whatever).

Is there a function in the standard Arduino libraries, that does this in a sensible fashion, so that I don't have to roll
something on my own (and probably worse)?

/ralph