Read sound sensor


#1

Hello, I am reading from a sound sensor like this one:

I analog read 4 bytes, and this is the result:

00000000 00 00 1a ff

  1. Why is the first part all 0?
  2. How do I get the actual value?

Thanks!


#2

Hi @LuCavallin,

That looks like an 8-byte number. Which by the way, what’s with the spacing in the number, or the other way, the lack of consistency? Was that output by the program/script/function call?

Theoretically, those zeros are just the bytes that compose the entire number. You can easily compute the number by following the advice on a previous thread of yours:

Heck, you can even do it manually:
cast number = 1 x 16 ^ 3 + 10 x 16 ^ 2 + 15 x 16 ^ 1 + 15 x 16 ^ 0 = 6911

Hope this all makes sense to you.

Robert