-
• #2
Which links are broken? All the ones are the end of the Getting Started guide seem to work for me.
You probably want:
- NRF.sleep - http://www.espruino.com/Reference#l_NRF_sleep
- NRF.wake - http://www.espruino.com/Reference#l_NRF_wake
- And
setWatch(function() { whatever }, BTN, {edge:"rising",debounce:50,repeat:true})
I'd hoped to have a few more tutorials up by now, but it's amazing what spending 6 hours a day answering emails does for your productivity :)
- NRF.sleep - http://www.espruino.com/Reference#l_NRF_sleep
-
• #3
Thx Gordon,
Those are the refs I needed. I'll post back here when I have tested code.
BTW. The broken links are in the version that's in github. The ones on the puck-js website are OK.
In terms of time for emails, I feel your pain :(
-
• #4
I think this is working OK. Is the advertising interval fixed at around 2 secs?
setWatch( function() { NRF.wake(); LED1.write(true); setTimeout(function() { LED1.write(false); setTimeout(function() { NRF.sleep(); },60*1000); // 1 minute },50); }, BTN, { edge:"rising", debounce: 50, repeat: true //?? } ); NRF.sleep();
The button seems super-sensitive. I checked that the device is reassembled correctly. Picking it up appears to activate it.
-
• #5
:) Ahh, gotcha - yes, the Espruino site is the one to use. Some of the links and keywords are automatically tweaked when it goes online
-
• #6
Can I use sleep and wake often or is that not recommended to disable and enable Bluetooth multiple times?
-
• #7
Are you using the up to date firmware? There was some odd issue with the one that the devices came flashed with where occasionally using
setWatch
would disable the button's pullup resistor, making it trigger too often.pinMode(BTN,"input_pulldown")
fixes it, but new firmware would be better.Advertising is ~700ms on 1v88 firmwares and ~350ms on 1v89 and later firmwares. BLE advertises on 3 separate frequency bands so if your phone/whatever is only listening on one it'd only pick a 1v88 firmware device up once every 2.1 seconds.
@MobiTech it should be fine to keep using sleep and wake - I don't see that causing any big problems.
-
• #8
Thx Gordon,
Adding that pinMode line caused it to stop waking up altogether (ie ignoring the button).
My puck is on 1v88. I will look for how to upgrade it. -
• #9
Sorry - I'm an idiot. It should have been
pinMode(BTN,"input_pulldown")
(the button pulls up to 3v when pressed).Firmware update info is here: http://www.espruino.com/Puck.js#firmware-updates
-
• #10
figure this out: putting the line in and then taking it out again cleared the problem. No rush to explain that as I am up and running.
I want to make a beacon that uses as little power (last as long) as possible.
Since puck has a button I thought I might get it to wake up on that and go into lowest power mode after a set period of advertising.
Looking at the links at the end of "Getting started". I was hoping to find some stuff about puck platform-specifics that would help me code up the above. As it is the links that looked useful are broken.