<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Hardware interrupts - Arduino				            </title>
            <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/</link>
            <description>Discussion board for Robotics, Arduino, Raspberry Pi and other DIY electronics and modules. Join us today!</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 12 Nov 2026 19:40:44 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48335</link>
                        <pubDate>Tue, 09 Jul 2024 17:05:01 +0000</pubDate>
                        <description><![CDATA[@danb 
I know. I was saying that the code will work with both switches pulled up if you use  !   operator in the interrupt.]]></description>
                        <content:encoded><![CDATA[<p>@danb </p>
<p>I know. I was saying that the code will work with both switches pulled up if you use  !   operator in the interrupt.</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>noweare</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48335</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48334</link>
                        <pubDate>Tue, 09 Jul 2024 14:19:41 +0000</pubDate>
                        <description><![CDATA[@noweare i just added pull down to one of the pins.]]></description>
                        <content:encoded><![CDATA[@noweare i just added pull down to one of the pins.]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>DanB</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48334</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48333</link>
                        <pubDate>Tue, 09 Jul 2024 13:44:47 +0000</pubDate>
                        <description><![CDATA[@danb It might be interesting to see what the compiler was thinking of the if statement before adding the explicit == 0 test. My thinking is it was NOT boolean, but some sort of bit variable...]]></description>
                        <content:encoded><![CDATA[<p>@danb It might be interesting to see what the compiler was thinking of the if statement before adding the explicit == 0 test. My thinking is it was NOT boolean, but some sort of bit variable. If it was one bit, then the code may work the same but in this case of multiple (8?) bits, I suspect there is a failure path.</p>
<p>As someone who has been writing code for over half a century, that kind of code still gives me headaches. I usually end up with something that works, but may not be the most elegant.</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>Ron</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48333</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48332</link>
                        <pubDate>Tue, 09 Jul 2024 13:10:10 +0000</pubDate>
                        <description><![CDATA[To work with pullups both statements in your interrupt should of been &quot;Notted&quot; (!).  Then the if statements in the interrupt would be true on a  high to low change.  You would still of neede...]]></description>
                        <content:encoded><![CDATA[<p>To work with pullups both statements in your interrupt should of been "Notted" (!).  Then the if statements in the interrupt would be true on a  high to low change.  You would still of needed the PINB change as well. </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>noweare</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48332</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48328</link>
                        <pubDate>Tue, 09 Jul 2024 09:24:55 +0000</pubDate>
                        <description><![CDATA[ok I solved it....
 
What I did.
1. I put a 10Kohm pull down resistor on Present_BIN (and of course removed the software pull_up)
2. I changed the code so I use
if ((PINB &amp; (1 &lt;&amp;...]]></description>
                        <content:encoded><![CDATA[<p>ok I solved it....</p>
<p> </p>
<p>What I did.</p>
<p>1. I put a 10Kohm pull down resistor on Present_BIN (and of course removed the software pull_up)</p>
<p>2. I changed the code so I use</p>
<div><span>if</span><span> </span><span>((</span><span>PINB &amp; </span><span>(</span><span>1</span><span> &lt;&lt;ESPdone</span><span>))</span><span> == </span><span>0</span><span>){}<br /></span>and<br />
<div>
<div>
<div><span>if</span><span> </span><span>(</span><span>!</span><span>(</span><span>PINB &amp; </span><span>(</span><span>1</span><span> &lt;&lt;Present_PIN</span><span>))</span><span> == </span><span>0</span><span>){}<br /><br />So I guess what made the change is that now one pin need to go high to activate, and the other need to go low.<br />or might just be the pull down resistor that did it all. But I dont want to put a pull down on present_pin just to test that.<br /><br />Thank you for the help here.<br /><br />Its really not easy when you first get in to C and bit shifting and what not .-)</span></div>
<div> </div>
</div>
</div>
</div>
<p><br /><br /></p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>DanB</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48328</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48326</link>
                        <pubDate>Tue, 09 Jul 2024 07:22:35 +0000</pubDate>
                        <description><![CDATA[@danb 
I have had to scroll around to look at different parts of your code to try to figure out what is going on.  
It would make it much easier to help you if you posted all of your code ...]]></description>
                        <content:encoded><![CDATA[<p>@danb </p>
<p>I have had to scroll around to look at different parts of your code to try to figure out what is going on.  </p>
<p>It would make it <strong>much easier</strong> to help you if you posted <strong>all</strong> of your code in one place. </p>
<p> </p>
<p>Try using PINB in your code and not pinState. Using PINB will always get the current state of that register. pinState only has the state of PINB when you made the assignment. </p>
<p> </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>noweare</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48326</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48325</link>
                        <pubDate>Tue, 09 Jul 2024 06:23:53 +0000</pubDate>
                        <description><![CDATA[@zander I wonder why the need for the &quot;tone&quot;?Of course I know how to copy/paste and use some common shortkeys.AND
Of course i did EXTENSIVE searching onine before posting.And I also did set...]]></description>
                        <content:encoded><![CDATA[<p>@zander I wonder why the need for the "tone"?<br />Of course I know how to copy/paste and use some common shortkeys.<br /><br />AND</p>
<p>Of course i did EXTENSIVE searching onine before posting.<br />And I also did setup the interupt for the pins (same way mentioned in the post you reference).</p>
<div>
<div><span>  //Setup external interrupt</span></div>
<div><span>  PCMSK |= </span><span>(</span><span>1</span><span> &lt;&lt; ESPdone</span><span>)</span><span>;</span></div>
<div><span>  PCMSK |= </span><span>(</span><span>1</span><span> &lt;&lt; Present_PIN</span><span>)</span><span>;</span></div>
<div><span>  GIMSK |= </span><span>(</span><span>1</span><span> &lt;&lt; PCIE</span><span>)</span><span>; <br /><br /></span>The problem is not that the interrupts dont trigger, the DO<br />The problem is that I cant seem to differentiate them.<br />Triggering one pin, also affects the other.<br /><br />Might be a coding issue, might be hardware, I cant figure it out, and that is why I ask here.<br />To get advice.</div>
</div>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>DanB</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48325</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48324</link>
                        <pubDate>Tue, 09 Jul 2024 06:08:28 +0000</pubDate>
                        <description><![CDATA[Yes I use pull_up on the pins.
But I read many many online posts, and found a few that mention that physical pull_down resistors might be the way to go. Any thoughts on that?
 
I realize ...]]></description>
                        <content:encoded><![CDATA[<p>Yes I use pull_up on the pins.</p>
<p>But I read many many online posts, and found a few that mention that physical pull_down resistors might be the way to go. Any thoughts on that?</p>
<p> </p>
<p>I realize I should have also added this part of the code,</p>
<div>
<div><span>uint8_t</span><span> pinState = PINB;</span></div>
</div>
<div> </div>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>DanB</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48324</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48323</link>
                        <pubDate>Tue, 09 Jul 2024 05:31:15 +0000</pubDate>
                        <description><![CDATA[@zander
 
Bitwise. 
I am al new to this... So... Bear with me. 
This
if (pinState &amp; (1 &lt;&lt;Present_PIN))
I try to Check if the present_pin is high in the pinState that contains...]]></description>
                        <content:encoded><![CDATA[<p>@zander</p>
<p> </p>
<p>Bitwise. </p>
<p>I am al new to this... So... Bear with me. </p>
<p>This</p>
<p><span>if</span><span> </span><span>(</span><span>pinState &amp; </span><span>(</span><span>1</span><span> &lt;&lt;Present_PIN</span><span>))</span></p>
<p>I try to Check if the present_pin is high in the pinState that contains all the pin states of all pins etc. like 00011000</p>
<p>Present_PIN is PB2 so that would Be the third from The right. So in this case. It would Be low and the if evaluate to false. </p>
<p>Right? </p>
<p> </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>DanB</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48323</guid>
                    </item>
				                    <item>
                        <title>RE: Hardware interrupts</title>
                        <link>https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48321</link>
                        <pubDate>Tue, 09 Jul 2024 02:30:27 +0000</pubDate>
                        <description><![CDATA[Do your buttons have pullups on them? Could your interrupt be changing states of other pins.
Please post all your code, it will make it easier to help us help you.]]></description>
                        <content:encoded><![CDATA[<p>Do your buttons have pullups on them? Could your interrupt be changing states of other pins.</p>
<p>Please post all your code, it will make it easier to help us help you.</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/arduino/">Arduino</category>                        <dc:creator>noweare</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/arduino/hardware-interrupts/#post-48321</guid>
                    </item>
							        </channel>
        </rss>
		