<?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>
									Trouble with millis() why is this not working - C++				            </title>
            <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/</link>
            <description>Discussion board for Robotics, Arduino, Raspberry Pi and other DIY electronics and modules. Join us today!</description>
            <language>en-US</language>
            <lastBuildDate>Sun, 11 Oct 2026 17:34:55 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37549</link>
                        <pubDate>Sun, 05 Feb 2023 15:18:43 +0000</pubDate>
                        <description><![CDATA[Ok Thanks]]></description>
                        <content:encoded><![CDATA[<p>Ok Thanks</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>DanEvils</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37549</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37548</link>
                        <pubDate>Sun, 05 Feb 2023 15:13:10 +0000</pubDate>
                        <description><![CDATA[@danevils You still don&#039;t understand, a battery maintainer which is what you need to overwinter your batteries is supposed to stay connected the entire season, not be repeatedly taken off an...]]></description>
                        <content:encoded><![CDATA[@danevils You still don't understand, a battery maintainer which is what you need to overwinter your batteries is supposed to stay connected the entire season, not be repeatedly taken off and put on. Buy one maintainer for each battery, it will be a lot cheaper in the long run.]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>Ron</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37548</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37543</link>
                        <pubDate>Sun, 05 Feb 2023 13:59:40 +0000</pubDate>
                        <description><![CDATA[Thanks Everyone I resolved my problem,  I change how my relays cycle and threw millis() to the curb.
for (int relay = 2; relay &lt; 10; relay++)
   digitalWrite(relay, HIGH);

   Serial....]]></description>
                        <content:encoded><![CDATA[<p>Thanks Everyone I resolved my problem,  I change how my relays cycle and threw millis() to the curb.</p>
<div style="text-align: justify"><span style="color: #ff0000">for (int relay = 2; relay &lt; 10; relay++)</span></div>
<div style="text-align: justify"><span style="color: #ff0000">   digitalWrite(relay, HIGH);</span></div>
<div style="text-align: justify">
<div><span style="color: #ff0000">   Serial.print(" Relay Value I Need  ");</span></div>
<div>  <span style="color: #ff0000"> delay();</span></div>
<div><span style="color: #ff0000">   digitalWrite(relay, LOW);</span></div>
<div><span>ETCETERA, </span><span>ETCETERA, </span><span>ETCETERA</span></div>
</div>
<div>
<div> </div>
</div>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>DanEvils</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37543</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37489</link>
                        <pubDate>Sat, 04 Feb 2023 17:50:56 +0000</pubDate>
                        <description><![CDATA[@will Somehow I didn&#039;t see that. But now I see he talks about taking the charger off every hour!!! Maintainers are designed to be put on and left until the battery goes back into service. Co...]]></description>
                        <content:encoded><![CDATA[@will Somehow I didn't see that. But now I see he talks about taking the charger off every hour!!! Maintainers are designed to be put on and left until the battery goes back into service. Constantly putting it on charge then off is bad for the battery.]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>Ron</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37489</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37488</link>
                        <pubDate>Sat, 04 Feb 2023 17:44:49 +0000</pubDate>
                        <description><![CDATA[@zander 
It&#039;s not in the original post but shows up here ...]]></description>
                        <content:encoded><![CDATA[<p>@zander </p>
<p>It's not in the original post but shows up here ...</p>
<p>https://forum.dronebotworkshop.com/postid/37469/</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>Will</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37488</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37486</link>
                        <pubDate>Sat, 04 Feb 2023 17:31:02 +0000</pubDate>
                        <description><![CDATA[@robotbuilder Can you show me where he said that in the original post?

Working on a DIY project to charge Multiple battery&#039;s Lawnmower, Motorcycle etc...  The problem I am Having is the S...]]></description>
                        <content:encoded><![CDATA[<p>@robotbuilder Can you show me where he said that in the original post?</p>
<blockquote>
<p>Working on a DIY project to charge Multiple battery's Lawnmower, Motorcycle etc...  The problem I am Having is the Serial.print only refreshes after relays run through it's loop. board  UNO Rev3 looking it my code Serial.print should refresh "printDelay = 50; the relays are batteryDetectTime = 300; my concept: in a if Control Structure the UNO Rev3 will set relay HIGH a acs712 sensor will detect if battery is connected if "true" it will charge battery if "false" it will go to next relay and I want to print status to a screen (type unknown at this time) I can't have screen refreshing every four min if four battery's are connected</p>
<h5>Can  someone point me in the right direction?</h5>
</blockquote>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>Ron</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37486</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37483</link>
                        <pubDate>Sat, 04 Feb 2023 16:58:50 +0000</pubDate>
                        <description><![CDATA[He did state that the setup was essentially to replace manually using the charger one at a time for his four batteries. It would make sense to read up about charging lead acid batteries to w...]]></description>
                        <content:encoded><![CDATA[
<p>@danevils Ok, I was afraid of that. So you are NOT building a battery charger, you are just turning off and on a commercial charger.</p>
<p></p>
<p> </p>
<p>He did state that the setup was essentially to replace manually using the charger one at a time for his four batteries. It would make sense to read up about charging lead acid batteries to work out the correct protocol even if it was being done manually using that particular charger.</p>
<p>The modern type of batteries used in hand tools and electric scooters and so on all use electronics to prevent damage or fires unless cheap rubbish is purchased as they have caught alight when left on a charger often resulting in burning down a house if left inside! With my hand drill the electronics is in the battery itself to prevent the voltage dropping too far during use and when plugged into the wall for charging.</p>
<p> </p>
<p> </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>robotBuilder</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37483</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37480</link>
                        <pubDate>Sat, 04 Feb 2023 15:47:53 +0000</pubDate>
                        <description><![CDATA[@danevils Ok, I was afraid of that. So you are NOT building a battery charger, you are just turning off and on a commercial charger. I assume you understand that turning off a proper battery...]]></description>
                        <content:encoded><![CDATA[<p>@danevils Ok, I was afraid of that. So you are NOT building a battery charger, you are just turning off and on a commercial charger. I assume you understand that turning off a proper battery maintainer (NOT a so called trickle charger) is a bad idea. If you left the charger on each battery for 1 or 2 weeks then it may not be so bad, but not ideal.</p>
<p>The best solution would be to 'read' the state of charge then you could use that to know when to turn a charger off. </p>
<p>If there is a light that indicates FULL, mounting a detector above it would be one crude solution, better would be to tap into the circuit that drives the light. I would still build in some sort of delay, say 2 weeks to a month between connecting the charger.</p>
<p>Since you will be connecting and disconnecting DC leads possibly under heavy load, consider using Solid State Relays or MOSFET's rather than mechanical relays as arcing may be a problem.</p>
<p>Good luck.</p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>Ron</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37480</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37472</link>
                        <pubDate>Sat, 04 Feb 2023 10:16:00 +0000</pubDate>
                        <description><![CDATA[@danevils 
Hope you don&#039;t mind but I can&#039;t help dabbling in the problem :)
Here is how I turn each relay (actually a LED in my setup test) one at a time.
My LEDs are actually connected to...]]></description>
                        <content:encoded><![CDATA[<p>@danevils </p>
<p>Hope you don't mind but I can't help dabbling in the problem :)</p>
<p>Here is how I turn each relay (actually a LED in my setup test) one at a time.</p>
<p>My LEDs are actually connected to a Mega so the pin numbers are not the ones you are using.</p>
<p> </p>
<pre contenteditable="false">int relay = {34, 35, 36, 37};  // LED PINS


unsigned long previousTime;
unsigned long currentTime;


int currentRelay = 0;


void setup() {
  Serial.begin(115200);
  // initialize pin numbers
  for (int i = 0; i&lt;4; i++){
    pinMode(relay,OUTPUT);
  }

  previousTime = millis();
  digitalWrite(currentRelay,HIGH);  // turn on first relay

}


void loop() {

  unsigned long currentTime = millis();


  if (currentTime - previousTime &gt; 3000) {

    previousTime = millis();
    digitalWrite(relay, LOW);  // turn off current LED
    currentRelay = currentRelay + 1;  // next relay
    if (currentRelay &gt; 3){
      currentRelay = 0;               // reset to zero
    }

    digitalWrite(relay,HIGH);  // turn on next LED

  }
  
}</pre>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>robotBuilder</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/paged/2/#post-37472</guid>
                    </item>
				                    <item>
                        <title>RE: Trouble with millis() why is this not working</title>
                        <link>https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/#post-37471</link>
                        <pubDate>Sat, 04 Feb 2023 08:11:53 +0000</pubDate>
                        <description><![CDATA[I would like to thank every one who responded to my question. it&#039;s going to take a minute or two to go through your response&#039;s.
I&#039;m currently rewriting the sketch trying to solve one proble...]]></description>
                        <content:encoded><![CDATA[<p>I would like to thank every one who responded to my question. it's going to take a minute or two to go through your response's.</p>
<p>I'm currently rewriting the sketch trying to solve one problem at a time.</p>
<p><a title="robotBuilder" href="https://forum.dronebotworkshop.com/participant/robotbuilder/">robotBuilder</a>  has a diagram of my project </p>]]></content:encoded>
						                            <category domain="https://forum.dronebotworkshop.com/c-plus-plus/">C++</category>                        <dc:creator>DanEvils</dc:creator>
                        <guid isPermaLink="true">https://forum.dronebotworkshop.com/c-plus-plus/trouble-with-millis-why-is-this-not-working/#post-37471</guid>
                    </item>
							        </channel>
        </rss>
		