You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • So my if else statement just changes What is being advertised, not When it will be advertised.

    correct, yes...

    My setInterval call determines the Frequency of the broadcast.

    Not really - that's just how often it calls your if statement, which doesn't affect the advertising speed.

    The actual advertising interval is an argument to setAdvertising: http://www.espruino.com/Reference#l_NRF_­setAdvertising

    For instance NRF.setAdvertising({0xFFFF:[0]},{interva­l:500});

    If I know it takes my son 3 minutes to get all of the dog food out and put it in bowls, then can't I set the interval to 60 seconds?

    Yes and no. Yes, I'd say set setInterval(sendAdvert, 60000); - so your 'if' statement gets called every minute. That'll be great for battery life.

    In terms of advertising, I'd set that to 10 seconds absolute maximum. Honestly once you get past once every few seconds you're making pretty small improvements to battery life. It's still going to last a year or so.

    I should add that Advertising sends data on 3 frequency bands, each in turn. However a lot of bluetooth radios only listen for advertising on one channel at once - so they'll only get every third transmission even if there is no interference at all. It really pays to make sure you send a few more packets than you absolutely need, especially as the cost is so low.

About

Avatar for Gordon @Gordon started