<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Arduino controlled Turntable	</title>
	<atom:link href="https://blog.model-train-help.com/2022/12/arduino-controlled-turntable.html/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.model-train-help.com/2022/12/arduino-controlled-turntable.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arduino-controlled-turntable</link>
	<description>Model railroads and model trains</description>
	<lastBuildDate>Fri, 16 Dec 2022 09:10:43 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: Nigel		</title>
		<link>https://blog.model-train-help.com/2022/12/arduino-controlled-turntable.html#comment-60765</link>

		<dc:creator><![CDATA[Nigel]]></dc:creator>
		<pubDate>Fri, 16 Dec 2022 09:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.model-train-help.com/?p=6603#comment-60765</guid>

					<description><![CDATA[I&#039;m not an expert on Arduino but do play around with them and also wanted to use one to control a turntable.

The following thread on RMWeb is excellent and provides a really good step by step description of the programming process including using a hall effect sensor to calibrate the turntable:

https://www.rmweb.co.uk/topic/78578-dcc-controlled-peco-turntable-project-using-a-arduino-uno/

I&#039;m not knowledgeable enough to comment on the specifics of your code but, hopefully, there&#039;ll be something on the link which solves your problem.

Good luck!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not an expert on Arduino but do play around with them and also wanted to use one to control a turntable.</p>
<p>The following thread on RMWeb is excellent and provides a really good step by step description of the programming process including using a hall effect sensor to calibrate the turntable:</p>
<p><a href="https://www.rmweb.co.uk/topic/78578-dcc-controlled-peco-turntable-project-using-a-arduino-uno/" rel="nofollow ugc">https://www.rmweb.co.uk/topic/78578-dcc-controlled-peco-turntable-project-using-a-arduino-uno/</a></p>
<p>I&#8217;m not knowledgeable enough to comment on the specifics of your code but, hopefully, there&#8217;ll be something on the link which solves your problem.</p>
<p>Good luck!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jim Christenson		</title>
		<link>https://blog.model-train-help.com/2022/12/arduino-controlled-turntable.html#comment-60663</link>

		<dc:creator><![CDATA[Jim Christenson]]></dc:creator>
		<pubDate>Thu, 08 Dec 2022 01:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.model-train-help.com/?p=6603#comment-60663</guid>

					<description><![CDATA[Tony,

This article helped me (remembered after last post...)  I want to move a stepper motor to an unknown home position until a switch is triggered, then move it down a little bit and call that position 0. 

See this link:   https://www.brainy-bits.com/post/homing-stepper-motors-using-the-accelstepper-library

Jim]]></description>
			<content:encoded><![CDATA[<p>Tony,</p>
<p>This article helped me (remembered after last post&#8230;)  I want to move a stepper motor to an unknown home position until a switch is triggered, then move it down a little bit and call that position 0. </p>
<p>See this link:   <a href="https://www.brainy-bits.com/post/homing-stepper-motors-using-the-accelstepper-library" rel="nofollow ugc">https://www.brainy-bits.com/post/homing-stepper-motors-using-the-accelstepper-library</a></p>
<p>Jim</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jim Christenson		</title>
		<link>https://blog.model-train-help.com/2022/12/arduino-controlled-turntable.html#comment-60662</link>

		<dc:creator><![CDATA[Jim Christenson]]></dc:creator>
		<pubDate>Thu, 08 Dec 2022 01:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.model-train-help.com/?p=6603#comment-60662</guid>

					<description><![CDATA[Tony,

My last post didn&#039;t look good at all, so I am going to show my actual code.  Note that my external switch &#039;trigger&#039; happens in either my client.loop() or ts.execute() method which I don&#039;t show.  The main part of the attached code is responsible for moving the stepper.

Jim]]></description>
			<content:encoded><![CDATA[<p>Tony,</p>
<p>My last post didn&#8217;t look good at all, so I am going to show my actual code.  Note that my external switch &#8216;trigger&#8217; happens in either my client.loop() or ts.execute() method which I don&#8217;t show.  The main part of the attached code is responsible for moving the stepper.</p>
<p>Jim</p>
<p><a href="https://blog.model-train-help.com/wp-content/comment-image/60662.jpg"><img src="https://blog.model-train-help.com/wp-content/comment-image/60662-tn.jpg"/></a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jim Christenson		</title>
		<link>https://blog.model-train-help.com/2022/12/arduino-controlled-turntable.html#comment-60661</link>

		<dc:creator><![CDATA[Jim Christenson]]></dc:creator>
		<pubDate>Thu, 08 Dec 2022 01:00:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.model-train-help.com/?p=6603#comment-60661</guid>

					<description><![CDATA[Tony,

It might help if you provided more details as to what is hooked up.  What causes pin 2 to change?  

So, assuming that pin 2 changes and you want to move you have two choices.  The AccelStepper library has a blocking and a non-blocking call to move the stepper.  Here is some code I am using to move a stepper:

void loop() {
    if (stepper1.distanceToGo() != 0 &#038;&#038; digitalRead(2) != HIGH) {
        stepper1.run();   // move the stepper
        delay(500);
    } else {
        digitalWrite(13, LOW);   // Stopped at limit?
    }
}


The key is to call the stepper1.run() until the distance to go is 0.

The other way to make the stepper to move is to use the blocking call.  Note that it will move without stopping, so if an external event (switch, etc) wants to stop movement it won&#039;t...

stepper1.runTopNewPosition(600);


I also don&#039;t think you loop is robust enough based on assumptions I am making about how this is triggered.  If you power-up and move you might put the stepper1.move(600) in your setup function, otherwise you might want to look for the condition that triggers the move in your loop() and move if it becomes true.]]></description>
			<content:encoded><![CDATA[<p>Tony,</p>
<p>It might help if you provided more details as to what is hooked up.  What causes pin 2 to change?  </p>
<p>So, assuming that pin 2 changes and you want to move you have two choices.  The AccelStepper library has a blocking and a non-blocking call to move the stepper.  Here is some code I am using to move a stepper:</p>
<p>void loop() {<br />
    if (stepper1.distanceToGo() != 0 &amp;&amp; digitalRead(2) != HIGH) {<br />
        stepper1.run();   // move the stepper<br />
        delay(500);<br />
    } else {<br />
        digitalWrite(13, LOW);   // Stopped at limit?<br />
    }<br />
}</p>
<p>The key is to call the stepper1.run() until the distance to go is 0.</p>
<p>The other way to make the stepper to move is to use the blocking call.  Note that it will move without stopping, so if an external event (switch, etc) wants to stop movement it won&#8217;t&#8230;</p>
<p>stepper1.runTopNewPosition(600);</p>
<p>I also don&#8217;t think you loop is robust enough based on assumptions I am making about how this is triggered.  If you power-up and move you might put the stepper1.move(600) in your setup function, otherwise you might want to look for the condition that triggers the move in your loop() and move if it becomes true.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
