<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>stepper motor &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/stepper-motor/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Sun, 03 May 2020 12:26:18 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创]通过Raspberry Pi(树莓派)的GPIO接口控制步进电机/Control stepper motor through the GPIO on Raspberry Pi</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b%e9%80%9a%e8%bf%87raspberry-pi%e6%a0%91%e8%8e%93%e6%b4%be%e7%9a%84gpio%e6%8e%a5%e5%8f%a3%e6%8e%a7%e5%88%b6%e6%ad%a5%e8%bf%9b%e7%94%b5%e6%9c%bacontrol-stepper-motor-through-the-g/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b%e9%80%9a%e8%bf%87raspberry-pi%e6%a0%91%e8%8e%93%e6%b4%be%e7%9a%84gpio%e6%8e%a5%e5%8f%a3%e6%8e%a7%e5%88%b6%e6%ad%a5%e8%bf%9b%e7%94%b5%e6%9c%bacontrol-stepper-motor-through-the-g/#comments</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Sat, 27 Oct 2012 05:37:40 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Raspberry Pi/树莓派]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[stepper motor]]></category>
		<category><![CDATA[树莓派]]></category>
		<category><![CDATA[步进电机]]></category>
		<guid isPermaLink="false">http://www.codelast.com/?p=5232</guid>

					<description><![CDATA[<p>
<a href="http://www.raspberrypi.org/" target="_blank" rel="noopener noreferrer">Raspberry Pi</a>是什么？<br />
引用维基百科的一句话：</p>
<blockquote>
<p>
		The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.</p>
</blockquote>
<p>简单地说，它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。<br />
<span style="color: rgb(0, 0, 255); ">In short, Pi is an ARM-based mini computer which has a credit card size.</span>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b%e9%80%9a%e8%bf%87raspberry-pi%e6%a0%91%e8%8e%93%e6%b4%be%e7%9a%84gpio%e6%8e%a5%e5%8f%a3%e6%8e%a7%e5%88%b6%e6%ad%a5%e8%bf%9b%e7%94%b5%e6%9c%bacontrol-stepper-motor-through-the-g/" class="read-more">Read More </a></p>]]></description>
										<content:encoded><![CDATA[<p>
<a href="http://www.raspberrypi.org/" target="_blank" rel="noopener noreferrer">Raspberry Pi</a>是什么？<br />
引用维基百科的一句话：</p>
<blockquote>
<p>
		The Raspberry Pi is a credit card sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools.</p>
</blockquote>
<p>简单地说，它就是一个基于ARM CPU的、信用卡那么大的迷你计算机。<br />
<span style="color: rgb(0, 0, 255); ">In short, Pi is an ARM-based mini computer which has a credit card size.</span></p>
<p>在阅读本文之前，请确保你已经阅读过我的另外几篇<a href="http://www.codelast.com/?p=5013" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122); ">关于Pi的文章</span></a>，因为本文与它们有或多或少的关系。<br />
<span style="color: rgb(0, 0, 255); ">Before reading this article, please make sure that you&#39;ve read&nbsp;<a href="http://www.codelast.com/?p=5013" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122); ">some other articles</span></a>&nbsp;of mine on Pi</span><span style="color: rgb(0, 0, 255); ">, because this article is more or less based on them.</span></p>
<p><span style="background-color: rgb(0, 255, 0); ">【1】</span>实验目的&nbsp;<span style="color: rgb(255, 0, 0); ">/</span>&nbsp;<span style="color: rgb(0, 0, 255); ">Experiment purpose</span><br />
在树莓派上编写一个C程序，通过其GPIO口控制步进电机的转动方向以及速度。<br />
<span style="color:#0000ff;">Write a C program to control the direction &amp; speed of rotation of a stepper motor through the GPIO on Raspberry Pi.</span><br />
<span id="more-5232"></span><br />
<span style="background-color:#00ff00;">【2】</span>为什么要用树莓派来控制步进电机 <span style="color:#ff0000;">/</span> <span style="color:#0000ff;">Why doing this</span><br />
在我的概念中，无论是<a href="http://www.codelast.com/?p=5014" target="_blank" rel="noopener noreferrer"><span style="background-color:#f0f8ff;">控制接在树莓派上的摄像头来拍照</span></a>，还是<a href="http://www.codelast.com/?p=5155" target="_blank" rel="noopener noreferrer"><span style="background-color:#f0f8ff;">通过树莓派控制LED发光</span></a>，我都还是在&ldquo;虚拟世界&rdquo;中折腾树莓派，因为它没有向外界输出任何动作。而在构建一个稍微复杂的系统时，这种能力可能是很重要的，于是，用树莓派来控制步进电机是我必须要做的事情。<br />
<span style="color:#0000ff;">In my view, no matter&nbsp;</span><a href="http://www.codelast.com/?p=5014" target="_blank" rel="noopener noreferrer"><span style="color:#0000ff;"><span style="background-color: rgb(240, 248, 255); ">using Pi to control webcam</span></span></a><span style="color:#0000ff;">, or </span><a href="http://www.codelast.com/?p=5155" target="_blank" rel="noopener noreferrer"><span style="color:#0000ff;"><span style="background-color: rgb(240, 248, 255); ">using Pi to light LED</span></span></a><span style="color:#0000ff;">, the Raspberry Pi was in a &quot;virtual&quot; world all the time because it didn&#39;t output any&nbsp;movement to the real world. Having this ability may be very important to build a slightly more complex system, so I decided to use Pi to control a stepper motor.</span><br />
<span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">【3】</span>实现方案 <span style="color:#ff0000;">/</span> <span style="color:#0000ff;">The implementation</span><br />
怎样通过Raspberry Pi的GPIO口来控制步进电机？已经有很多人这样做了。<br />
<span style="color:#0000ff;">How to control a stepper motor through the GPIO on Pi? Lots of people have tried that before</span><span style="color:#0000ff;">.</span><br />
由于步进电机通常需要一块驱动板，而这样的产品已经很容易买到并且极其廉价（肯定比你自己做要便宜），因此，我们没有必要自己去做。我在淘宝上不断地查啊查，终于找到了白菜价的步进电机和配套驱动板，加起来才一共8块多钱。<br />
<span style="color:#0000ff;">Because we need a driver circuit board to drive the stepper motor, and it&#39;s really easy to buy this kind of product with super low price nowadays, so it&#39;s no need to make it ourselves. I searched taobao.com(the largest e-commerce website&nbsp;in China) and found a super cheap stepper motor &amp; it&#39;s matched driver board, they cost me only about 8 RMB, that is, less than $1.5!</span></p>
<p>下面来看看我买的步进电机和驱动板的样子：<br />
<span style="color:#0000ff;">The stepper motor &amp; it&#39;s driver board:</span></p>
<div style="text-align: center; ">
	<img decoding="async" alt="stepper motor and it's driver board" src="https://www.codelast.com/wp-content/uploads/2012/10/stepper_motor_and_driver_board.jpg" style="width: 555px; height: 186px; " /></div>
<p><span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
步进电机和驱动板的接线：<br />
<span style="color:#0000ff;">Connect the stepper motor with it&#39;s driver board:</span></p>
<div style="text-align: center; ">
	<img decoding="async" alt="stepper motor connected with driver board" src="https://www.codelast.com/wp-content/uploads/2012/10/stepper_motor_connected_with_driver_board.jpg" style="width: 500px; height: 281px; " /></div>
<p><span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
该驱动板配有一个原理图，根据它我们可以知道如何把整个系统连接起来：<br />
<span style="color:#0000ff;">The driver board has a&nbsp;schematic diagram and we can learn from it how to connect the whole system together:</span></p>
<div style="text-align: center; ">
	<img decoding="async" alt="stepper motor driver board diagram" src="https://www.codelast.com/wp-content/uploads/2012/10/stepper_motor_driver_board_diagram.jpg" style="width: 520px; height: 401px; " /></div>
<p>可见，驱动板上有4个输入口：IN1~IN4，这4个口用来接树莓派的4个GPIO口。同时，我们需要为驱动板提供5V的供电，这从哪里来？当然是从树莓派引出来。从下面的GPIO口分布图可以得知，&ldquo;2&rdquo;口就是+5V，正好就利用它。<br />
<span style="color:#0000ff;">We can see that there are total 4 input pins: IN1~IN4, these 4 pins will be connected to 4 GPIO pins on Raspberry Pi. And we also need to provide a 5V power supply to the board, so where can we get this? Use the pin &quot;2&quot;(5V) next to pin &quot;1&quot;(3.3V)&nbsp;</span><span style="color: rgb(0, 0, 255); ">on Pi&nbsp;</span><span style="color:#0000ff;">is the most convenient way. Refer to following GPIO pinouts for details:</span></p>
<div style="text-align: center; ">
	<img decoding="async" alt="Raspberry Pi 2 kinds of pinout names" src="https://www.codelast.com/wp-content/uploads/2012/10/raspberry_pi_gpio_pin_2_kinds_of_names.jpg" style="width: 546px; height: 365px; " /></div>
<p><span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
我将树莓派上的GPIO 17、18、21、22口（用树莓派的命名方式就是0、1、2、3口）分别接到步进电机驱动板上的IN1、IN2、IN3、IN4口，最后接好线的效果如下：<br />
<span style="color:#0000ff;">I connected GPIO 17, 18, 21, 22(namely GPIO 0, 1, 2, 3 in Raspberry Pi name) on Pi to IN1, IN2, IN3, IN4 on the driver board separately, after it&#39;s done, the whole system looks like this:</span></p>
<div style="text-align: center; ">
	<img decoding="async" alt="Raspberry Pi &amp; stepper motor &amp; driver board connected together" src="https://www.codelast.com/wp-content/uploads/2012/10/raspberry_pi_stepper_motor_driver_board_connect_together.jpg" style="width: 500px; height: 267px; " /></div>
<p><span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
<span style="background-color:#00ff00;">【4】</span>编写程序 <span style="color:#ff0000;">/</span> <span style="color:#0000ff;">Write the program</span><br />
在参考了这款步进电机配套的51单片机的示例代码后，我知道了依次把驱动板的IN1~IN4置为高电平，就可以驱动步进电机，也就是说，要把树莓派的4个GPIO输出口依次置为高电平。例如，假设用0代表低电平，1代表高电平的话，GPIO 17、18、21、22口的电平第一次被置为1、0、0、0，第二次被置为0、1、0、0，第三次被置为0、0、1、0，第四次被置为0、0、0、1。<br />
<span style="color:#0000ff;">After checking the code(for MCS51 singlechip) provided by the product dealer I knew that it&#39;s possible to drive the motor by set IN1~IN4 high level in turn, namely set the 4 GPIO pins high level in turn. For example, if we use 0 to represent low level and 1 to represent high level, then GPIO 17, 18, 21, 22 on Raspberry Pi will be set to 1,0,0,0 in the 1st round, 0,1,0,0 in the 2nd round, 0,0,1,0 in the 3rd round and 0,0,0,1 in the 4th round.</span></p>
<p>于是我写出了下面的代码（仍然使用<a href="https://projects.drogon.net/raspberry-pi/wiringpi/" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">WiringPi</span></a>这个库来操作GPIO）：<br />
<span style="color:#0000ff;">So I wrote the following code(still use </span><a href="http://projects.drogon.net/raspberry-pi/wiringpi/" target="_blank" rel="noopener noreferrer"><span style="color:#0000ff;"><span style="background-color: rgb(255, 160, 122); ">WiringPi</span></span></a><span style="color:#0000ff;"> to manipulate the GPIO):</span></p>
<pre class="brush:cpp;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
/* moto.c
* A program to control a stepper motor through the GPIO on Raspberry Pi. 
* 
* Author: Darran Zhang (http://www.codelast.com) 
*/

#include &lt;wiringPi.h&gt;
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdlib.h&gt;

#define CLOCKWISE 1
#define COUNTER_CLOCKWISE 2

void delayMS(int x);
void rotate(int* pins, int direction);

int main(int argc,char* argv[]) {
	if (argc &lt; 4) {
		printf(&quot;Usage example: ./motor 0 1 2 3 \n&quot;);
		return 1;
	}

	/* number of the pins which connected to the stepper motor driver board */
	int pinA = atoi(argv[1]);
	int pinB = atoi(argv[2]);
	int pinC = atoi(argv[3]);
	int pinD = atoi(argv[4]);

	int pins[4] = {pinA, pinB, pinC, pinD};

	if (-1 == wiringPiSetup()) {
		printf(&quot;Setup wiringPi failed!&quot;);
		return 1;
	}

	/* set mode to output */
	pinMode(pinA, OUTPUT);
	pinMode(pinB, OUTPUT);
	pinMode(pinC, OUTPUT);
	pinMode(pinD, OUTPUT);

	delayMS(50);		// wait for a stable status 
	for (int i = 0; i &lt; 500; i++) {
		rotate(pins, CLOCKWISE);
	}

	return 0;
}

/* Suspend execution for x milliseconds intervals.
 *	@param ms Milliseconds to sleep.
 */
void delayMS(int x) {
	usleep(x * 1000);
}

/* Rotate the motor.
 *	@param pins			A pointer which points to the pins number array.
 *  @param direction	CLOCKWISE for clockwise rotation, COUNTER_CLOCKWISE for counter clockwise rotation.
 */
void rotate(int* pins, int direction) {
	for (int i = 0; i &lt; 4; i++) {
		if (CLOCKWISE == direction) {
			for (int j = 0; j &lt; 4; j++) {
				if (j == i) {
					digitalWrite(pins[3 - j], 1); // output a high level 
				} else {
					digitalWrite(pins[3 - j], 0); // output a low level 
				}
			}
		} else if (COUNTER_CLOCKWISE == direction) {
			for (int j = 0; j &lt; 4; j++) {
				if (j == i) {
					digitalWrite(pins[j], 1); // output a high level 
				} else {
					digitalWrite(pins[j], 0); // output a low level 
				}
			}
		}
		delayMS(4);
	}
}
</pre>
<p><span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
编译程序：<br />
<span style="color:#0000ff;">Compile the code:</span></p>
<pre class="brush:as3;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
g++ motor.c -o motor -lwiringPi
</pre>
<p>运行程序：<br />
<span style="color:#0000ff;">Run the program:</span></p>
<pre class="brush:shell;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
./motor 0 1 2 3
</pre>
<p>这里向程序传入了4个参数，它们分别代表要控制的树莓派的GPIO口。切记，由于使用了WiringPi库，所以要参考上面的GPIO分布图的左边那部分来确定这些数字。<br />
<span style="color:#0000ff;">The four arguments passed to the program are the GPIO pin numbers on Pi. Be sure to keep in mind that because of using WiringPi, we need to refer to the left part of the GPIO pinouts image describe above to identify the numbers.</span></p>
<p>可以看到步进电机已经转动了(如<a href="http://v.youku.com/v_show/id_XNDY3NTE1NDk2.html" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">下面的Youku视频</span></a>所示)。如果你发现转动方向（顺/逆时针）反了，你可以把传入的参数顺序调整一下，就可以让它转对方向。<br />
<span style="color:#0000ff;">Then we&#39;ll see the stepper motor start to rotate shown as <a href="http://www.youtube.com/watch?v=AMkBE-UvOY0" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">this Youtube video</span></a>. If you find that the direction of rotation is wrong, just adjust the order of the arguments passed to the program and it will be able to make the <span class="KSFIND_CLASS_SELECT" id="0KSFindDIV">direction right</span>.</span><br />
<iframe frameborder="0" height="498" scrolling="no" src="http://player.youku.com/embed/XNDY3NTE1NDk2" width="510"></iframe><br />
从前面的代码可见，如果要改变步进电机的转速，只需要改变rotate()函数中每次delay的时间即可。因此，如果我们把delay的时间逐渐由大变小，就会导致步进电机呈加速状态。让步进电机周期性加速的完整代码如下：<br />
<span style="color:#0000ff;">From the code above we know that we can change the rotation speed of the motor by changing the delay time in function rotate(). So if we reduce the delay time gradually, the motor will be in an accelerating state. The full source code to make the motor speeding up periodically is shown below:</span></p>
<pre class="brush:cpp;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;">
/* motor_speed_up.c
* A program to control a stepper motor(speed up) through the GPIO on Raspberry Pi. 
* 
* Author: Darran Zhang (http://www.codelast.com) 
*/

#include &lt;wiringPi.h&gt;
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdlib.h&gt;

#define CLOCKWISE 1
#define COUNTER_CLOCKWISE 2

void delayMS(int x);
void rotate(int* pins, int direction, int delay);
void stop(int* pins);

int main(int argc,char* argv[]) {
	if (argc &lt; 4) {
		printf(&quot;Usage example: ./motor 0 1 2 3 \n&quot;);
		return 1;
	}

	/* number of the pins which connected to the stepper motor driver board */
	int pinA = atoi(argv[1]);
	int pinB = atoi(argv[2]);
	int pinC = atoi(argv[3]);
	int pinD = atoi(argv[4]);

	int pins[4] = {pinA, pinB, pinC, pinD};

	if (-1 == wiringPiSetup()) {
		printf(&quot;Setup wiringPi failed!&quot;);
		return 1;
	}

	/* set mode to output */
	pinMode(pinA, OUTPUT);
	pinMode(pinB, OUTPUT);
	pinMode(pinC, OUTPUT);
	pinMode(pinD, OUTPUT);

	delayMS(50);		// wait for a stable status 
	int delay = 25;
	while (true) {
		for (int i = 0; i &lt; 10; i++) {
			rotate(pins, CLOCKWISE, delay);
		}
		delay--;
		if (delay &lt; 4) {
			delay = 25;
			stop(pins);
			delayMS(500);
		}
	}

	return 0;
}

/* Suspend execution for x milliseconds intervals.
 *	@param ms Milliseconds to sleep.
 */
void delayMS(int x) {
	usleep(x * 1000);
}

/* Rotate the motor.
 *	@param pins			A pointer which points to the pins number array.
 *  @param direction	CLOCKWISE for clockwise rotation, COUNTER_CLOCKWISE for counter clockwise rotation.
 *	@param delay		The time intervals(in ms) to delay, and if the value is smaller, the motor rotates faster.
 */
void rotate(int* pins, int direction, int delay) {
	for (int i = 0; i &lt; 4; i++) {
		if (CLOCKWISE == direction) {
			for (int j = 0; j &lt; 4; j++) {
				if (j == i) {
					digitalWrite(pins[3 - j], 1); // output a high level 
				} else {
					digitalWrite(pins[3 - j], 0); // output a low level 
				}
			}
		} else if (COUNTER_CLOCKWISE == direction) {
			for (int j = 0; j &lt; 4; j++) {
				if (j == i) {
					digitalWrite(pins[j], 1); // output a high level 
				} else {
					digitalWrite(pins[j], 0); // output a low level 
				}
			}
		}
		delayMS(delay);
	}
}

/* Stop the motor.
 *	@param pins			A pointer which points to the pins number array.
 */
void stop(int* pins) {
	for (int i = 0; i &lt; 4; i++) {
		digitalWrite(pins[i], 0); // output a low level 
	}
}
</pre>
<p><span style="color: rgb(255, 255, 255); ">文章来源：</span><a href="http://www.codelast.com/" target="_blank" rel="noopener noreferrer"><span style="color: rgb(255, 255, 255); ">http://www.codelast.com/</span></a><br />
程序运行效果如下面的视频（<a href="http://v.youku.com/v_show/id_XNDY3NzI5Mzk2.html" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Youku</span></a>，<a href="http://www.youtube.com/watch?v=5mwTnMOaPZg" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Youtube</span></a>）所示：<br />
<span style="color:#0000ff;">Run the program and then you&#39;ll see the speeding up effect, as the video(<a href="http://v.youku.com/v_show/id_XNDY3NzI5Mzk2.html" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Youku</span></a>, <a href="http://www.youtube.com/watch?v=5mwTnMOaPZg" target="_blank" rel="noopener noreferrer"><span style="background-color:#ffa07a;">Youtube</span></a>) shown below:</span><br />
<iframe loading="lazy" frameborder="0" height="498" scrolling="no" src="http://player.youku.com/embed/XNDY3NzI5Mzk2" width="510"></iframe><br />
至此，本文的主要目的已经达到。如果你还想对树莓派了解更多，请看<a href="http://www.codelast.com/?p=5013" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122); ">这些文章</span></a>。<br />
<span style="color: rgb(0, 0, 255); ">So the main&nbsp;purpose of this article has been reached. If you want to know more about Pi, please read&nbsp;<a href="http://www.codelast.com/?p=5013" target="_blank" rel="noopener noreferrer"><span style="background-color: rgb(255, 160, 122); ">these articles</span></a>.</span></p>
<p><span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
	<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
<div id="KSFIND_MASK" style="background-color: rgb(0, 0, 0); opacity: 0.22; position: absolute !important; left: 0px !important; top: 0px !important; border: 0px none !important; padding: 0px !important; z-index: 1000000 !important; height: 0px; width: 0px; display: none; cursor: auto; ">
	&nbsp;</div>

			<!--[syntaxhighlighter]-->
			<!--代码高亮，请勿编辑-->
			<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shCore.js"></script><script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushCpp.js"></script>
<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushAS3.js"></script>
<script type="text/javascript" src="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushShell.js"></script>

			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shCoreCk.css" />
			<link type="text/css" rel="stylesheet" href="https://www.codelast.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/styles/shThemeCk.css" />
			<script type="text/javascript">
			SyntaxHighlighter.defaults['class-name']	= '';
			SyntaxHighlighter.defaults['smart-tabs']	= true;
			SyntaxHighlighter.defaults['tab-size']		= 2;
			SyntaxHighlighter.defaults['gutter']		= true;
			SyntaxHighlighter.defaults['quick-code']	= true;
			SyntaxHighlighter.defaults['collapse'] 		= false;
			SyntaxHighlighter.defaults['auto-links']	= true;
			SyntaxHighlighter.defaults['toolbar']		= true;
			SyntaxHighlighter.all();
			</script>
			<!--[/syntaxhighlighter]-->]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b%e9%80%9a%e8%bf%87raspberry-pi%e6%a0%91%e8%8e%93%e6%b4%be%e7%9a%84gpio%e6%8e%a5%e5%8f%a3%e6%8e%a7%e5%88%b6%e6%ad%a5%e8%bf%9b%e7%94%b5%e6%9c%bacontrol-stepper-motor-through-the-g/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
