septillion:
Question 1, why is the buffer global and not part of the function?
Question 2, why use a buffer? You can just send it as you go...
I am using a buffer because I was doing other things with it, but yes it can just be a series of mySerial.write() commands.
Initially I was referring to the buffer from other functions - that's not the case now, so it's no longer static or global and is declared inside the sendCommand function.
It shows a clever way to use the union operation to combine
arrays to automatically go from bytes to integers by just
putting them into an array.
No shift or multiply operation. The array you use to hold the values
can do all the work for you.
Dwight
thanks septillion, I had a feeling you hard-core C programmers were just teasing me.
I learned C when I was 12 y.o and then hardly did any programming in it until about 6 months ago, but I did manage to find some of my old notes, and of course this great forum.
thank you to all for your help, feedback and suggestions.