Go Down

Topic: Explanation of program needed (Read 817 times) previous topic - next topic

moomoo

one character = one byte?
Quote
3) Not necessary for oxyLevel, and not necessary for most of heartRate.

means i can just remove those 2 statements? :)

Groove

No. Just one of them.
If you look at my rework, you don't need them at all.

Can you explain what it is you don't understand?
Is it how numbers are represented in binary?
How whole values or bits are assigned?
Per Arduino ad Astra

moomoo

Quote
[2.) if(nss.available() >= 3)  - i don't understand how this works./quote]
Code: [Select]
2) check to see if at least three characters have been received from the nss serial interface


does one character refer to one byte?

Quote
3) Not necessary for oxyLevel, and not necessary for most of heartRate.


I don't understand this quote..sorry.. :(

Groove

1) in this case yes,one character == one byte

2) You're going to write a whole new value in to oxyLevel, so setting it to zero is pointless.
In the case of heart-rate, you have an int variable, but you are using only 10 bits of the sixteen.
Normally, the other six would be undefined, so you would have to set them to zero.
However, because of how and where you have declared the heart-rate variable, the compiler has already initialised all sixteen bits to zero, so the siz unused bits will never be over-written, and the other ten will all be updated each time through the loop.
Per Arduino ad Astra

Go Up