Disclaimer - its past my bedtime, apologies if this is asked and answered and my fritzing/mspain mashup makes no sense.
Short of it is that I’ve got this touch panel that is fed 3v via 3v & gnd from my photon, but the touch panel is always at 3v - normally closed I guess. I started confident I knew what I was doing but I think I’m missing something. I can catch the drop in voltage on the multimeter just enough to more or less confirm that it probably doing what I think - which is normally closed, so 3v to the D4 pin, and then open when pressed momentarily.
I don’t have control over the design of the switch - exceeds my motivation anyway, but its bugging me that its just out of reach.
First the code:
#define buttonpin D4
volatile int buttonPressed = 0;
void buttonPressed();
void setup()
{
pinMode(buttonpin,INPUT_PULLDOWN);
attachInterrupt(buttonpin,buttonPressed,FALLING);
}
void loop(){}
void buttonPressed()
{
Particle.publish("I'm im-Pressed","go to bed already",PRIVATE);
}
I’ve tried pullup, pulldown, nothing, rising, falling, change… if I do anything other than Falling, it just continuously thinks somethings happening and spams the console - almost like its floating, which I’d have thought pull-up or down would have taken care of (maybe I need a bigger resistor?)
Keep in mind, I haven’t actually tested this chopped version - but I’ve tried some variations using a volatile int to try and grab a value and have been considering doing this analog and seeing if its actually going to zero or if its just going on holiday.
(again, sorry - I’m fading here) - here’s my sad attempt at Fritzing (couldn’t for the sleep deprived life of me find a normally closed 3 pin ‘lit’ button).
In case you’re curious, this is the touch panel off of an aeon labs touch panel for their micro dimmer - I had a good reason for wanting to do this (that is at the edge of my memory - though now its more that I have the pieces and they’re gathering dust…)
Here’s the back and front side of the switch:
I believe the model is AL001-W-US (swap W with B for black). I’ve not checked out what the 'K2, K3, K4’s do yet - one thing at a time.
The end goal is essentially to pipe this via MQTT and through something hopefully not too annoying, end up on my Hubitat controller. Right now I’d settle for it not freezing up, rebooting unpredictably, taking half a flash and just rebooting again, and just generally being a pain in the ass. And now its time to dream of electric sheep…
Any thoughts (or RTFM’s with useful tidbits) would be very welcomed.