This option was included in the manufacturer’s documentation for the switch and I thought it would be a great idea to have a button that lit only while being pressed.
Does the board output enough voltage and would this interfere with its working as a switch?
The board uses a 40k pull-up resistor on the button pad. You won’t get enough current for the LED to be visible from that.
Well shoot. Honoured by a reply by the man himself though.
Is there a way to replicate that functionality in software?
Absolutely, many ways in fact… ![:slight_smile: :slight_smile:](https://crucible.hubbe.net/images/emoji/twitter/slight_smile.png?v=12)
They all require a little bit of coding, but perhaps the easiest is to create a custom style, like:
template<int pin>
class ReadPinSVF {
public:
void run(BladeBase* blade) {}
int calculate(BladeBase* blade) {
return digitalRead(pin) == HIGH ? 32768 : 0;
}
};
template<int pin>
using ReadPinF = SingleValueAdapter<ReadPinSVF<pin>>;
(You can put this in the new CONFIG_STYLES section.)
Then you can write the style for your LED like this:
StylePtr<Mix<ReadPinSVF<powerButtonPin>, White, Black>>()
3 Likes