I built a trip wire for the post box that I'm connecting. It's however based on a mercury tilt sensor so I'm really not sure whether I think it's a great idea putting it to use (at least not with a sturdy case...). However, I can share my code:
#define DIGITAL_INPUT_SENSOR 2 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
MyMessage msgTripped(CHILD_ID_TRIPPED, V_TRIPPED);
void setup()
{
gw.sendSketchInfo("Postal", "1.0");
gw.present(CHILD_ID_TRIPPED, S_MOTION);
pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
}
void loop()
{
boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == LOW;
if(tripped) {
gw.send(msgTripped.set("1")); // Send tripped value to gw
}
gw.sleep(INTERRUPT,FALLING, SLEEP_TIME);
}
@kalina, Thanks. So it will not work for my configuration. Wall switch (push button) is already installed. No possibilities to draw more electrical wires.
Moreover, if i put the board near the light, i have just the Neutral and the return wire from the wall switch. No Live wire to power on the mysensors board.
I think in my ase the best way is to manage everything in my garage in the electrical main board where all the wires are mapped. I can get L + N for mysensors power supply. And i can continue to reuse the original wall switch independently of the Mysensors board.
@Nca78 said in Dimmable LED kitchen light (Arduino, APDS-9960, RGBWW led):
Do you use a relay to control the leds or still a MOSFET ?
i'm using mosfets.