<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Why does it work...sometimes?</title><link>/products/arduino/b/blog/posts/why-does-it-work-sometimes</link><description>Why does this code loaded on a Nano knockoff work sometimes, if I clearly missed a section of code?
int LEDPin = 9;int ButtonPin = 8;int RelayPin = 2;
void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LEDPin, OUTPUT); pinMode</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Why does it work...sometimes?</title><link>https://community.element14.com/products/arduino/b/blog/posts/why-does-it-work-sometimes</link><pubDate>Sun, 10 Jul 2022 08:04:30 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a883c194-ce81-48e6-ae79-05da9af5bbe3</guid><dc:creator>misaz</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Do you connect pull-up resistor on button pin? Describe or post schematics of your button connection.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=23939&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Why does it work...sometimes?</title><link>https://community.element14.com/products/arduino/b/blog/posts/why-does-it-work-sometimes</link><pubDate>Sat, 09 Jul 2022 15:55:46 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a883c194-ce81-48e6-ae79-05da9af5bbe3</guid><dc:creator>ralphjy</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I would guess that your two breadboard circuits are not hooked up identically.&amp;nbsp; Are the other components on the breadboards besides the Nano the same?&amp;nbsp; What Nano knockoff are you using?&amp;nbsp; I think Jan&amp;#39;s suggestion of measuring voltages will lead you to the cause.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=23939&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Why does it work...sometimes?</title><link>https://community.element14.com/products/arduino/b/blog/posts/why-does-it-work-sometimes</link><pubDate>Sat, 09 Jul 2022 15:25:09 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a883c194-ce81-48e6-ae79-05da9af5bbe3</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;The compiler did not show an error because you made no c++ syntax error.&lt;/p&gt;
&lt;p&gt;For the ATMxxx type of Arduinos, if you don&amp;#39;t set PIN mode, they are high-Z, floating. Undetermined.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you still havethe working and non-working setups, put a volt meter on the pin and check if you measure a difference ...&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=23939&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>