to me, the setInterval is redundant to the setAdvertising
This is your problem.
Try the code I gave you or the code in the example, and see if it works.
If you call setAdvertising once then advertising data will be set, but it'll be set just once so the value will not change until you call it again. Hence the need for setInterval to update the advertising with new light values.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
This is your problem.
Try the code I gave you or the code in the example, and see if it works.
If you call
setAdvertising
once then advertising data will be set, but it'll be set just once so the value will not change until you call it again. Hence the need forsetInterval
to update the advertising with new light values.