• the above code doesn't work correctly for me

    It's strange - it doesn't appear well for me either - but when dumping the raw advertising data received I do see the 2 types of advertising packet being sent as they should be. If Scan Response works then that's probably best then.

    I still cannot understand though how you can represent, lets say 1000 states, with 255 numbers.

    You're right, you can't :) It's basically just turning 1000 states into 256 states, but the light measurement isn't accurate enough that it really matters. You could always use 2 bytes for 16 bits (DataView is good for that).

About

Avatar for Gordon @Gordon started