Skip to content

Commit

Permalink
Add more on rpi & linux
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 9, 2014
1 parent aa0c054 commit 81da4b7
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 29 deletions.
Binary file modified build/designiot.epub
Binary file not shown.
64 changes: 44 additions & 20 deletions build/designiot.mobi
@@ -1,22 +1,3 @@
<table>
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"></td>
<td align="left"></td>
<td align="left"></td>
</tr>
</tbody>
</table>
<p>毕业论文:<a href="http://designiot.phodal.com/iot.html" title="基于REST服务的最小物联网系统设计">基于REST服务的最小物联网系统设计</a></p>
<p><strong>下载PDF版</strong>:<a href="http://designiot.phodal.com/build/iot.pdf" class="uri">http://designiot.phodal.com/build/iot.pdf</a></p>
<p><strong>下载EPUB版</strong>:<a href="http://designiot.phodal.com/build/designiot.epub" class="uri">http://designiot.phodal.com/build/designiot.epub</a></p>
<p><strong>下载MOBI版</strong>:<a href="http://designiot.phodal.com/build/designiot.mobi" class="uri">http://designiot.phodal.com/build/designiot.mobi</a></p>
<h2>一步步搭建物联网系统</h2>
<div id="TOC">
<ul>
<li><a href="#前言"><span class="toc-section-number">1</span> 前言</a>
Expand Down Expand Up @@ -141,6 +122,7 @@
<ul>
<li><a href="#geek的盛宴"><span class="toc-section-number">9.1</span> Geek的盛宴</a></li>
<li><a href="#raspberry-pi-初始化"><span class="toc-section-number">9.2</span> Raspberry Pi 初始化</a></li>
<li><a href="#raspberry-pi-gpio"><span class="toc-section-number">9.3</span> Raspberry Pi GPIO</a></li>
</ul></li>
<li><a href="#http与restful"><span class="toc-section-number">10</span> HTTP与RESTful</a>
<ul>
Expand Down Expand Up @@ -1351,6 +1333,9 @@ a<span class="ch">[href^=</span><span class="st">&quot;#&quot;</span><span class
}
}</code></pre>
<p>以上程序实现字符的输出(Serial.write(),Serial.print())和读入(Serial.read())。如果需要了解更多,可以参考:<a href="www.arduino.cc">Arduino官网</a></p>
<blockquote>
<p>I2C(Inter-Integrated Circuit)总线是由PHILIPS公司开发的两线式串行总线,用于连接微控制器及其外围设备。是微电子通信控制领域广泛采用的一种总线标准。 &gt; &gt; I2C 总线支持任何IC 生产过程(NMOS CMOS、双极性)。两线――串行数据(SDA)和串行时钟 (SCL)线在连接到总线的器件间传递信息。每个器件都有一个唯一的地址识别(无论是微控制器——MCU、LCD 驱动器、存储器或键盘接口),而且都可以作为一个发送器或接收器(由器件的功能决定)。很明显,LCD 驱动器只是一个接收器,而存储器则既可以接收又可以发送数据。除了发送器和接收器外器件在执行数 据传输时也可以被看作是主机或从机(见表1)。主机是初始化总线的数据传输并产生允许传输的时钟信号 的器件。此时,任何被寻址的器件都被认为是从机。</p>
</blockquote>
<h3 id="关于arduino-setup"><span class="header-section-number">7.5.1</span> 关于Arduino Setup()</h3>
<p>如果你对Arduino的Setup很疑惑的话,可以看看这里。下面Arduino源码目录中的main函数:</p>
<pre class="sourceCode cpp"><code class="sourceCode cpp"><span class="ot">#include &lt;Arduino.h&gt;</span>
Expand All @@ -1363,7 +1348,6 @@ a<span class="ch">[href^=</span><span class="st">&quot;#&quot;</span><span class
loop();
<span class="kw">if</span> (serialEventRun) serialEventRun();
}

<span class="kw">return</span> <span class="dv">0</span>;
}</code></pre>
<h1 id="python"><span class="header-section-number">8</span> Python</h1>
Expand Down Expand Up @@ -1472,14 +1456,54 @@ a process or set of rules to be followed in calculations or other problem-solvin
</blockquote>
<p>也就是计算或其他解决问题的操作需要遵循的一个过程或者一套规则,书上还提到的说法是——解决问题的诀窍,让我想起了hack一词。我们总会去想某些东西是否有一个更快的计算方法,有时候在处理某些问题上也显示了一个好的算法的重要性。</p>
<h2 id="实用主义哲学"><span class="header-section-number">8.3</span> 实用主义哲学</h2>
<p>(来自于:HyryStudio)</p>
<p>大多数工程师、科学家使用科学计算软件的目的都是为了快速解决其工作中遇到的问题,而不是开发出一套完整的软件。这就是为什么MATLAB这样的商用科学计算软件十分流行的原因。而Python在这一点上实际上和MATLAB十分相似,我们也可以使用Python众多的扩展库快速写出一次性的数据处理、运算的脚本。然而由于Python语言的一些高级特性,以及众多的科学计算之外的扩展库,我们可以将积累下来的一次性脚本进行改造,为它们提供命令行、GUI、数据库、网络等众多接口,最终成为一套完整的工具包或者实用的计算软件。而且由于是开源的自由软件,我们可以在任何系统中安装Python环境,运行我们 的程序。</p>
<p>Python一直保持着很强的实用主义,它通常不会去试着重新开发一整套函数库,而是将现有的开源函数库包装成其扩展库。而Python则通过这些扩展库将众多的开源函数库连接在一起,是名符其实的胶水语言。例如由华盛顿大学的教授主导开发的 Sage ,就是一套以代替MATLAB、Mathematica、Maple等商用科学计算软件为目的的开源系统。它通过Python结合了众多的开源科学计算软件,并通过网页浏览器提供了一个与其交互的记事本文档界面。 Python的科学计算扩展库非常多,不同专业的技术人员都可以找到适合自己的扩展库。下面是我经常会用到的一个非常不完全的列表:</p>
<ul>
<li>NumPy + SciPy + matplotlib + IPython : 这几个应该是每位开发者都应具备的扩展库。NumPy提供了多维数组以及众多的处理函数,SciPy提供了各种数值运算功能,matplotlib能绘制 出精美的二维图表,IPython则提供了一个超强的命令行,最新版的IPython还添加于Sage类似的浏览器的记事本界面(notebook)。</li>
<li>SciKits : 其中包括许多独立的扩展库,作为SciPy的补充。其中 scikit-learn 是一套机器学习库,包含了比较完善的文档以及众多的实例程序。</li>
<li>Pandas : 以Python世界中 R 的替代品为目标的数据分析库。根据其官方网站的测试,Pandas在许多方面的性能都比R要高。</li>
<li>ETS : 这是一套Enthought公司开发的函数库,其中的 Mayavi 能很方便地对数据进行三维可视化。</li>
<li>OpenCV : 这是一套计算机视觉库,目前的最新版本已经提供了十分完备的Python接口,能够调用OpenCV中众多的图像处理、模式识别函数直接对NumPy数组进行处理。</li>
</ul>
<h2 id="包管理-1"><span class="header-section-number">8.4</span> 包管理</h2>
<ul>
<li>Eggs 格式是 setuptools 引入的一种文件格式,它使用 .egg 扩展名,用于 Python 模块的安装。</li>
<li>pip 是目前 python 包管理的事实标准,2008年发布。它被用作 easy_install 的替代品,但是它仍有大量的功能建立在 setuptools 组件之上。</li>
</ul>
<h1 id="raspberry-pi"><span class="header-section-number">9</span> Raspberry Pi</h1>
<h2 id="geek的盛宴"><span class="header-section-number">9.1</span> Geek的盛宴</h2>
<p>Raspberry Pi是一款针对电脑业余爱好者、教师、小学生以及小型企业等用户的迷你电脑,预装Linux系统,体积仅信用卡大小,搭载ARM架构处理器,运算性能和智能手机相仿。在接口方面,Raspberry Pi提供了可供键鼠使用的USB接口,此外还有千兆以太网接口、SD卡扩展接口以及1个HDMI高清视频输出接口,可与显示器或者TV相连。</p>
<p>Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。</p>
<p>Raspberry Pi相比于一般的ARM开发板来说,由于其本身搭载着Linux操作系统,可以用诸如Python、Ruby或Bash来执行脚本,而不是通过编译程序来运行,具有更高的开发效率。</p>
<h2 id="raspberry-pi-初始化"><span class="header-section-number">9.2</span> Raspberry Pi 初始化</h2>
<p>今天的Raspberry Pi默认已经安装<code>openssh-server</code>,并已经可以登陆上去了。</p>
<p>接着我们就可以看到系统启动了,要我们输入用户名和密码</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">Raspbian</span> GNU/Linux 7 raspberrypi ttyAMA0

<span class="kw">raspberrypi</span> login: pi
<span class="kw">Password</span>:
<span class="kw">Last</span> login: Sat Apr 26 05:58:07 UTC 2014 on ttyAMA0
<span class="kw">Linux</span> raspberrypi 3.10.25+ <span class="co">#622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l</span>

<span class="kw">The</span> programs included with the Debian GNU/Linux system are free software<span class="kw">;</span>
<span class="kw">the</span> exact distribution terms for each program are described in the
<span class="kw">individual</span> files in /usr/share/doc/*/copyright.

<span class="kw">Debian</span> GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
<span class="kw">permitted</span> by applicable law.
<span class="kw">ls</span>

<span class="kw">NOTICE</span>: the software on this Raspberry Pi has not been fully configured. Please run <span class="st">&#39;sudo raspi-config&#39;</span></code></pre>
<p>然后</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> raspi-config</code></pre>
<p>选择第一个,下面就可以继续了</p>
<p><code>Expand Filesystem Ensures that all of the SD card s</code></p>
<h2 id="raspberry-pi-gpio"><span class="header-section-number">9.3</span> Raspberry Pi GPIO</h2>
<div class="figure">
<img src="./images/gpio.png" alt="GPIO" />
<p>GPIO</p>
</div>
<h1 id="http与restful"><span class="header-section-number">10</span> HTTP与RESTful</h1>
<h2 id="你所没有深入的http"><span class="header-section-number">10.1</span> 你所没有深入的HTTP</h2>
<p>Internet有两个核心协议: IP和TCP,这样讲述起来似乎会很漫长。</p>
Expand Down
Binary file modified build/iot.pdf
Binary file not shown.

0 comments on commit 81da4b7

Please sign in to comment.