Can I use Puck.js as a simple tally counter that I would carry in my pocket? #4389
Replies: 1 comment
-
Posted at 2025-02-06 by @gfwilliams Hi! Yes, it'd work fine for that! The following may be what you want:
When you press the button, it'll increment the counter. It should be possible to just open iOS's bluetooth menu and search to add a new device (don't actually add it!) and you'll see a device called If you want to stop accidental presses there are other things you could do - like make it only record a press when it's a long one, or when you have two pressed in quick succession. Posted at 2025-02-06 by user159590 Gordon, thank you so much for that response. Posted at 2025-02-07 by @allObjects @user159590 There are several approaches to make sure not to count 'butt calls'... I mean: 'butt counts'. @gfwilliams mentioned that as
For that I have made some code a while ago... and leans on the idea of Morse code. How to make it easy and still reliable depends also on how frequently that pressing happens. What is the shortest time between presses? And how many of these presses in 'fast' succession? If the handling allows the pressing under sight, you can take the built in LEDs to show different color, which you have to confirm correctly. For example, when it lights up green, you have to press the sequence short-long(er), and if it is red, long(er)-short. The SW can then even acknowledge that you confirmed correctly with, for example, two blue flashes. But as mentioned in previous paragraph: it all depends on how you the pressing happens. Detecting the different presses and connect it to an action is very simple when looking at this piece of code at the end of this Post #25, which is part of a whole conversation that deals with what you can do with a single button: Software Buttons - Many buttons from just one hardware button Instead of firing the I have no clue about the application - but: Instead of a Puck, could a Bangle(2) do the same thing? Bangle1 had a two zone touch, and Bangle2 has way more flexibility and can make it also extremely safe.. and even with a display of the counter to give you ongoing (validation) feedback... Give this code a shot:
You can run this Puck code in the espruino.com/ide emulator (connect to Bangle2 emulated), since the LED1 and LED2 are emulated as well, and there is a button to click on with the mouse or track pad or point ... The short presses are really sort and also the pauses between the presses. You change that in the C(onfig) object.
Instead of pulling the SWBtn module from the web, you can copy what is in referenced Post #25 and play around. Let me know your questions or comments. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2025-02-06 by user159590
I have a very simple use case: I need to carry a device in my pocket such that I can press a button and have it increase a tally count. So at the end of the day, I could say, "OK, I pressed the button 39 times today". I tried using one of those cheap, dedicated tally counters that you can buy on Amazon, but the button gets pressed just from the little device jostling around inside my pocket (for various reasons, I can't clip it to my belt or wear it on my wrist or whatever). Can the Puck.js do this? And can I carry it around in my pocket without the button being pressed accidentally? Also, how would I retrieve the tally count? Would it connect to my iPhone, or would I need to pair it to my computer, or...? Thank you.
Beta Was this translation helpful? Give feedback.
All reactions