How to use 'either' latching or momentary switches?

I have seen some projects out there that are user definable (from a config.txt file on SD card)…

where you can set if you want to use a latching or momentary switch for your main power button.

Im curious as to how that is done?

At first knee jerk reaction was… not hard. Simple a code routine to check the state of the button and do ‘whatever’…

but then I started to feel I was over/under thinking it… and there has to be more to it?

Id like to hear fromanyone with some experience… so I can understand better. :smiley:

thanks

xl97: I have seen some projects out there that are user definable (from a config.txt file on SD card)...

Making a latching or soft-power button isn't particularly difficult. Doing so on the Arduio board introduces an interesting challenge since the board itself doesn't have any hardware to support "ON" or "OFF". So all power really needs to come from off-board.

The "from a config.txt file on SD card" makes my head turn. Maybe you should point to such a project and investigate how THEY implemented such a feature...

soft-power? (thanks I can search on that term no w too)

not sure what a project that takes variables/data form an SD card for its program makes your head turn? (its not Arduino based FYI)

but something that got my interest.. enough to ask at least.

I dont believe the button has anything to do with 'power'.. (per se`).. as once you pull the kill key.. it 'powers up with a boot sound'.. so things have 'power'..

it was just declaring (again in the config) what type of switch you would be soldering to the board...

Im assuming this just 'starts/initiates the 'program'...

So my thinking of (at this point, in this type of project).. does it even matter really? youre only checking for a button state.. and then moving on.. if you dont check for that button state again.. does it matter if latching or momentary?

Thanks

xl97: not sure what a project that takes variables/data form an SD card for its program makes your head turn? (its not Arduino based FYI)

That isn't what you said initially. Your comment was: "I have seen some projects out there that are user definable (from a config.txt file on SD card)...where you can set if you want to use a latching or momentary switch for your main power button." Such behavior for main power button is the curious part.

xl97: Im assuming this just 'starts/initiates the 'program'...

Again, not what you said originally.

xl97: youre only checking for a button state.. and then moving on.. if you dont check for that button state again.. does it matter if latching or momentary?

If you are just using the button as an input, then it doens't matter. But that isn't what you asked. You asked about main power. That's a soft-power button.

In terms of Inputs, the hardware you'd want is a momentary button. The behavior of the button can be altered in software. (This is of course unless you want a button that physically stays in one place, in which case, you have to have a latching button/switch.)

ok..so getting to an answer after my bad description is.. doesnt matter. (and I guess its hard to say as,... giving power to the board straight just 'boots it up' but you have to use a switch to turn on the power or initialize it to 'do anything'.... (and its referred to as the MAIN power switch in its docs)

anyways..

the hardware I want in terms of 'input' is 'not' momentary.. (its 'whatever').. ie: a 'choice'..

but as you mentioned it shouldnt matter.

*(although thinking of the other project.. I wonder why they have the user define it at all then?)

xl97: ok..so getting to an answer after my bad description is.. doesnt matter. (and I guess its hard to say as,... giving power to the board straight just 'boots it up' but you have to use a switch to turn on the power or initialize it to 'do anything'.... (and its referred to as the MAIN power switch in its docs)

I have absolutely ZERO clue to what you are trying to say here. I think you are leaving out multiple references or details.

ok..so getting to your answer after my bad description is........ doesnt matter.

in reference to the other project I have seen ... giving power to the board straight just 'boots it up' (ie: it plays a sound when 'power' is applied to the board)....but you have to use a switch to turn on the 'program' or initialize it to 'do anything'.... (and its referred to as the MAIN power switch in its docs...which is probably why I was using that term and mis-leading you.)

Okay, I get it now. :) Thanks for explaining again.