<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Interrupt driven contact sensor]]></title><description><![CDATA[<p dir="auto">I've modified the sketch I use for temperature/humidity/barometer to remove the barometer and implement a magnetic door sensor. My plan is for this to be installed in/on my gun safe to monitor interior temperature and humidity and log whenever the safe is opened/closed.</p>
<p dir="auto">Basically the contact sensor works but of course its loop-driven so it doesn't report when the door is actually opened/closed. It also reports every OTHER reporting cycle for some reason.</p>
<p dir="auto">I have the sensor wired to Arduino Pin D3. Can someone guide me in making the contact sensor interrupt driven to report immediately?</p>
<p dir="auto">Thanks<br />
John</p>
]]></description><link>https://forum.mysensors.org/topic/271/interrupt-driven-contact-sensor</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Nov 2026 07:45:50 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/271.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Aug 2014 00:32:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Interrupt driven contact sensor on Fri, 08 Aug 2014 02:08:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bandra" aria-label="Profile: Bandra">@<bdi>Bandra</bdi></a> Looks fairly simple, maybe its time to upgrade to 1.4</p>
]]></description><link>https://forum.mysensors.org/post/2771</link><guid isPermaLink="true">https://forum.mysensors.org/post/2771</guid><dc:creator><![CDATA[clippermiami]]></dc:creator><pubDate>Fri, 08 Aug 2014 02:08:18 GMT</pubDate></item><item><title><![CDATA[Reply to Interrupt driven contact sensor on Fri, 08 Aug 2014 02:01:24 GMT]]></title><description><![CDATA[<p dir="auto">In your sketch you may just be sleeping on a timer.  Ie:</p>
<pre><code>gw.sleep(SLEEP_TIME);
</code></pre>
<p dir="auto">With the 1.4 beta improvements, there's now provision to sleep on timer AND on interrupt.  Like this:</p>
<pre><code>#define DIGITAL_INPUT_SENSOR 3   // D3 is the only interrupt pin left (radio uses D2)
#define INTERRUPT DIGITAL_INPUT_SENSOR-2
unsigned long SLEEP_TIME = 30000;

void setup() {
  pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the digital pin as input
}

void loop() {
    ...
    gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
}
</code></pre>
<p dir="auto">That may not all be exactly right, but it should be pretty close.</p>
]]></description><link>https://forum.mysensors.org/post/2770</link><guid isPermaLink="true">https://forum.mysensors.org/post/2770</guid><dc:creator><![CDATA[Bandra]]></dc:creator><pubDate>Fri, 08 Aug 2014 02:01:24 GMT</pubDate></item></channel></rss>