<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:atom="http://www.w3.org/2005/Atom">
   <channel>
      <title>Prepare NAzTBlog</title>
      <description>preparation for http://www.together.in.th</description>
      <link>http://pipes.yahoo.com/pipes/pipe.info?_id=7933fc99c9d208dd3a068186fac9eb59</link>
      <atom:link rel="next" href="http://pipes.yahoo.com/pipes/pipe.run?_id=7933fc99c9d208dd3a068186fac9eb59&amp;_render=rss&amp;page=2"/>
      <pubDate>Thu, 01 Oct 2015 23:25:08 +0000</pubDate>
      <generator>http://pipes.yahoo.com/pipes/</generator>
      <item>
         <title>วิธีการ compile และติดตั้ง bluez 5.27 ใน odroid</title>
         <link>http://www.together.in.th/embedded-system/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3-compile-%e0%b9%81%e0%b8%a5%e0%b8%b0%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-bluez-5-27-%e0%b9%83%e0%b8%99-odroid/</link>
         <description>compile และ ตัดตั้ง Bluez 5.27 ใน odroid sudo apt-get - [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4510</guid>
         <pubDate>Sat, 17 Jan 2015 01:22:25 +0000</pubDate>
         <content:encoded><![CDATA[<p>compile และ ตัดตั้ง Bluez 5.27 ใน odroid</p>
<p><img style="display:block;margin-left:auto;margin-right:auto;" src="http://i1.wp.com/www.together.in.th/wp-content/uploads/2015/01/Screen-Shot-2558-01-17-at-7.50.08-AM.png?resize=600%2C583" alt="Screen Shot 2558 01 17 at 7 50 08 AM" title="Screen Shot 2558-01-17 at 7.50.08 AM.png" border="0"/><span id="more-4510"></span>sudo apt-get -y install libglib2.0-dev  libical-dev<br />
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.27.tar.xz -O- | tar xvJ ; cd bluez-5.27;<br />
./configure &#8211;disable-systemd<br />
make -j4<br />
sudo make install;</p>
<p>ถ้าข้างบนมีปัญหาให้ copy ข้างล่างนี่ไปนะครับ</p>
<style>.gist table {margin-bottom:0;}</style>
<p></p> 

<div class="wp_rp_wrap  wp_rp_plain" id="wp_rp_first"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/cc/compile-c-with-google-c-testing-framework/" class="wp_rp_title">Compile C++ With Google C++ Testing Framework</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3-share-internet-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-bluetooth/" class="wp_rp_title">วิธีการ Share internet ผ่าน Bluetooth (Mac OS X)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/unix-network-programming-installation-command/" class="wp_rp_title">Unix Network Programming [Installation-Command]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/hack-your-brain/write-a-function-to-determine-if-a-number-is-a-power-of-2/" class="wp_rp_title">เขียนโปรแกรม ตรวจสอบ &#8220;Power Of 2&#8243; ยังไงดี</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/%e0%b9%80%e0%b8%a3%e0%b8%b4%e0%b9%88%e0%b8%a1%e0%b8%95%e0%b9%89%e0%b8%99%e0%b8%87%e0%b9%88%e0%b8%b2%e0%b8%a2%e0%b9%86%e0%b8%81%e0%b8%b1%e0%b8%9a-github/" class="wp_rp_title">เริ่มต้นง่ายๆกับ GitHub</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/bluetooth/" title="bluetooth">bluetooth</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/bluez/" title="bluez">bluez</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/compile/" title="compile">compile</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/linux/" title="linux">linux</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/odroid/" title="odroid">odroid</a><br />]]></content:encoded>
      </item>
      <item>
         <title>ส่ง SMS บน Raspberry Pi ด้วย python</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/</link>
         <description>หัวใจหลักอยู่ที่ AT Command ถ้าศึกษา AT Command แล้ว ทำ [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4497</guid>
         <pubDate>Sun, 16 Nov 2014 08:56:39 +0000</pubDate>
         <content:encoded><![CDATA[<p><img style="display:block;margin-left:auto;margin-right:auto;" title="1004855_642671052411357_51254179_n.png" src="http://i0.wp.com/www.together.in.th/wp-content/uploads/2014/11/1004855_642671052411357_51254179_n.png?resize=298%2C166" alt="1004855 642671052411357 51254179 n" border="0"/></p>
<p>หัวใจหลักอยู่ที่ AT Command ถ้าศึกษา AT Command แล้ว ทำตามนี้ก็ได้เลย ได้ทุกระบบ (เพราะมันใช้ Serial Port)<span id="more-4497"></span>มีรูปจาก Facebook อยู่ด้านล่าง รอโหลดแป้บนึงนะครับ</p>
<p></p> 

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/" class="wp_rp_title">ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-vnc-server-remote-desktop/" class="wp_rp_title">การติดตั้ง VNC Server (Remote Desktop)</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/3g-dongle/" title="3g dongle">3g dongle</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/python/" title="python">python</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/sms/" title="sms">sms</a><br />]]></content:encoded>
      </item>
      <item>
         <title>ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/</link>
         <description>สวัสดีครับ วันนี้มาพบกับ Blog สั้นๆ ขี้เกียจๆ เหมือนเดิ [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4482</guid>
         <pubDate>Thu, 23 Oct 2014 03:06:06 +0000</pubDate>
         <content:encoded><![CDATA[<p>สวัสดีครับ วันนี้มาพบกับ Blog สั้นๆ ขี้เกียจๆ เหมือนเดิมนะครับ.. เรื่องการต่อ 3g ด้วย Raspberry Pi ครับ งวดนี้ทดสอบ 3G ของ True Move H ที่ความเร็ว 7mbps กับ ​AIS 21mbps ครับ&#8230; ใช้งานได้ทั้งคู่ครับ&#8230;  ซึ่งจะเป็นตัวนี้นะครับ..<span id="more-4482"></span>.</p>
<p><a rel="nofollow" target="_blank" href="https://flic.kr/p/pGRfYS"><img src="https://farm6.staticflickr.com/5600/15558476386_8672fee44c_n.jpg" alt="&#x000e17;&#x000e14;&#x000e2a;&#x000e2d;&#x000e1a;&#x000e01;&#x000e31;&#x000e1a; raspberry Pi &#x000e40;&#x000e23;&#x000e35;&#x000e22;&#x000e1a;&#x000e23;&#x000e49;&#x000e2d;&#x000e22; &#x000e40;&#x000e14;&#x000e35;&#x000e4b;&#x000e22;&#x000e27;&#x000e01;&#x000e25;&#x000e31;&#x000e1a;&#x000e21;&#x000e32;&#x000e41;&#x000e0a;&#x000e23;&#x000e4c;&#x000e19;&#x000e30;&#x000e04;&#x000e23;&#x000e31;&#x000e1a;." width="320" height="240"/></a></p>
<p>.<br />
ผลลัพธ์คือใช้ได้ทั้งคู่นะครับ.. ซึ่งทั้งสอง จะเป็นของ Huewei ทั้งคู่ครับ ซึ่ง True move H จะเป็น Huawei E303F ส่วน AIS ใหม่กว่าจะเป็น E137 ครับ<br />
ใช้ได้ทั้งคู่ คำสั่งที่ใช้ คือ..  </p>
<style>.gist table {margin-bottom:0;}</style>
<p></p> 
<p>ถ้าใครทำตามข้างบนยังไม่ได้ ให้ เริ่มใหม่ตามนี้นะครับ..</p>
<style>.gist table {margin-bottom:0;}</style>
<p></p> 
<p>สำหรับ DTAC&#8230;. </p>
<p></p> 
<p></p> 

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/" class="wp_rp_title">การทดสอบ servo บน bash shell ใน raspberry pi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-vnc-server-remote-desktop/" class="wp_rp_title">การติดตั้ง VNC Server (Remote Desktop)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/3g-dongle/" title="3g dongle">3g dongle</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/ais/" title="ais">ais</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/true-move-h/" title="true-move-h">true-move-h</a><br />]]></content:encoded>
      </item>
      <item>
         <title>การติดตั้ง VNC Server (Remote Desktop)</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-vnc-server-remote-desktop/</link>
         <description>ถึงแม้ว่าปกติแล้วผมจะใช้ SSH ในการเข้าถึง และสั่งการ Ra [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4466</guid>
         <pubDate>Mon, 28 Jul 2014 13:44:34 +0000</pubDate>
         <content:encoded><![CDATA[<p>ถึงแม้ว่าปกติแล้วผมจะใช้ SSH ในการเข้าถึง และสั่งการ Raspberry Pi เป็นหลัก แต่ก็ไม่สามารถปฏิเสธการใช้ GUI ได้</p>
<p>งั้นวันนี้เรามาติดตั้ง VNC Server บน Raspberry Pi กันครับ<span id="more-4466"></span>ขั้นแรกให้สั่ง</p>
<blockquote><p>$ sudo apt-get update</p>
<p>$ sudo apt-get install tightvncserver -y</p></blockquote>
<p>แล้วก็สร้างไฟล์ใหม่ขึ้นมา</p>
<blockquote><p>$ sudo vi /etc/init.d/tightvncserver</p></blockquote>
<p>โดยเนื้อหาเป็นดังนี้ครับ</p>
<style>.gist table {margin-bottom:0;}</style>
<p></p> 
<p>แล้วก็ปรับ permission</p>
<p>$ sudo chmod +x /etc/init.d/tightvncserver<br />
สั่งให้รันตอนเปิดเครื่อง..</p>
<blockquote><p>$ sudo update-rc.d tightvncserver defaults</p></blockquote>
<p>เสร็จพิธี..</p>
<p>แถม VIDEO ด้วยครับ<br />
</p> 

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/" class="wp_rp_title">ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/" class="wp_rp_title">การทดสอบ servo บน bash shell ใน raspberry pi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/remote-control/" title="remote control">remote control</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/vnc/" title="vnc">vnc</a><br />]]></content:encoded>
      </item>
      <item>
         <title>การทดสอบ servo บน bash shell ใน raspberry pi</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/</link>
         <description>การทดสอบ servo บน bash shell ใน Raspberry Pi ครับ #netu [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4453</guid>
         <pubDate>Tue, 03 Jun 2014 00:33:50 +0000</pubDate>
         <content:encoded><![CDATA[<p>การทดสอบ servo บน bash shell ใน Raspberry Pi ครับ</p>
<pre><code>#netural
echo 1=150 &gt; /dev/servoblaster
echo 0=150 &gt; /dev/servoblaster

#go right max = 250
echo 1=180 &gt; /dev/servoblaster

#go left min  = 50
echo 1=150 &gt; /dev/servoblaster

#go up  max = 80
echo 0=80 &gt; /dev/servoblaster

#go down  min = 220
echo 0=220&gt; /dev/servoblaster
</code></pre>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-vnc-server-remote-desktop/" class="wp_rp_title">การติดตั้ง VNC Server (Remote Desktop)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/" class="wp_rp_title">ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/groovy/grails/grails-bash-completion/" class="wp_rp_title">grails bash completion</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/bash/" title="bash">bash</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberypi/" title="raspberypi">raspberypi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/servo/" title="servo">servo</a><br />]]></content:encoded>
      </item>
      <item>
         <title>วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/</link>
         <description>สืบเนื่องจากตอนที่แล้ว วิธีการตรวจสอบว่า Raspberry Pi ต [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4436</guid>
         <pubDate>Tue, 15 Apr 2014 14:20:55 +0000</pubDate>
         <content:encoded><![CDATA[<p>สืบเนื่องจากตอนที่แล้ว <a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/&#x000e27;&#x000e34;&#x000e18;&#x000e35;&#x000e01;&#x000e32;&#x000e23;&#x000e15;&#x000e23;&#x000e27;&#x000e08;&#x000e2a;&#x000e2d;&#x000e1a;&#x000e27;&#x000e48;&#x000e32;-raspberry-pi-&#x000e15;&#x000e48;&#x000e2d;-wifi/">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></p>
<p>การใช้ ifconfig แล้ว grep เอา inet addr อาจไม่ได้ผลครับ ผมเคยเจอเคสที่ grep ยังเจอ inet addr อยู่ แต่เล่นเน็ตไม่ได้ครับ (ความจริงคือหลุดไปแล้ว)</p>
<p><img alt="example-wifimaster" src="https://farm8.staticflickr.com/7368/13847720054_2bcdb78ff5_z_d.jpg"/></p>
<p>ผมแก้ไขโดยให้ใช้วิธีจำลองการใช้เน็ตของเราด้วยการใช้คำสั่ง <code>curl</code> เลยครับ จะ request ไปที่ google หรืออะไรก็ได้ครับ แต่สำหรับผมจะ request ไปยัง radius server ตรงๆเลยครับ ถ้าหลุดไปแล้ว ก็สั่ง ifdown / ifup เหมือนเดิมครับ</p>
<p>code จะเป็นแบบนี้ครับ</p>
<pre><code>#!/bin/bash
while true; do
  curl --fail --silent http://10.5.50.1/status &gt; /dev/null
  if [[ $? -ne 0 ]]; then
    echo "WIFI DOWN! $(date)"
    sudo /sbin/ifdown --force wlan0
    sudo /sbin/ifup --force wlan0
    sleep 5
    python /home/pi/mikrotik-autologin/mtlogin.py 1234 1234
  else
    echo "OK"
    sleep 5
  fi
done;
</code></pre>
<p>ภาพตัวอย่างอยู่ด้านบนนะครับ อิอิ</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-vnc-server-remote-desktop/" class="wp_rp_title">การติดตั้ง VNC Server (Remote Desktop)</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/curl/" title="curl">curl</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/linux/" title="linux">linux</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/network/" title="network">network</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/radius-server/" title="radius server">radius server</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/rpi/" title="rpi">rpi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/wifi/" title="wifi">wifi</a><br />]]></content:encoded>
      </item>
      <item>
         <title>Install &amp; Compile opengl / glut / freeglut on Mac OSX Mavericks</title>
         <link>http://www.together.in.th/programming-2/cc/install-compile-opengl-glut-freeglut-on-mac-osx-mavericks/</link>
         <description>Install opengl / glut / freeglut on Mac OSX Mavericks $ [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4440</guid>
         <pubDate>Tue, 15 Apr 2014 03:45:14 +0000</pubDate>
         <content:encoded><![CDATA[<p>Install opengl / glut / freeglut on Mac OSX Mavericks</p>
<pre><code>$ brew install freeglut
</code></pre>
<p>Download example source code from: http://openglsamples.sourceforge.net/triangle.html</p>
<pre><code><span id="more-4440"></span>
/*
 * OpenGLSamples (openglsamples.sf.net) Examples
 * VC++ users should create a Win32 Console project and link 
 * the program with glut32.lib, glu32.lib, opengl32.lib
 *
 * GLUT can be downloaded from http://www.xmission.com/~nate/glut.html
 * OpenGL is by default installed on your system.
 * For an installation of glut on windows for MS Visual Studio 2010 see: http://nafsadh.wordpress.com/2010/08/20/glut-in-ms-visual-studio-2010-msvs10/
 *
 */

#include &lt;stdio.h&gt;
//#include &lt;GL/gl.h&gt;       // Open Graphics Library (OpenGL) header
#include &lt;GL/glut.h&gt;     // The GL Utility Toolkit (GLUT) Header

#define KEY_ESCAPE 27

typedef struct {
    int width;
  int height;
  char* title;

  float field_of_view_angle;
  float z_near;
  float z_far;
} glutWindow;

glutWindow win;

void display() 
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);        // Clear Screen and Depth Buffer
  glLoadIdentity();
  glTranslatef(0.0f,0.0f,-3.0f);      

  /*
   * Triangle code starts here
   * 3 verteces, 3 colors.
   */
  glBegin(GL_TRIANGLES);          
    glColor3f(0.0f,0.0f,1.0f);      
    glVertex3f( 0.0f, 1.0f, 0.0f);    
    glColor3f(0.0f,1.0f,0.0f);      
    glVertex3f(-1.0f,-1.0f, 0.0f);    
    glColor3f(1.0f,0.0f,0.0f);      
    glVertex3f( 1.0f,-1.0f, 0.0f);    
  glEnd();        

  glutSwapBuffers();
}

void initialize () 
{
    glMatrixMode(GL_PROJECTION);                        // select projection matrix
    glViewport(0, 0, win.width, win.height);                  // set the viewport
    glMatrixMode(GL_PROJECTION);                        // set matrix mode
    glLoadIdentity();                             // reset projection matrix
    GLfloat aspect = (GLfloat) win.width / win.height;
  gluPerspective(win.field_of_view_angle, aspect, win.z_near, win.z_far);   // set up a perspective projection matrix
    glMatrixMode(GL_MODELVIEW);                         // specify which matrix is the current matrix
    glShadeModel( GL_SMOOTH );
    glClearDepth( 1.0f );                           // specify the clear value for the depth buffer
    glEnable( GL_DEPTH_TEST );
    glDepthFunc( GL_LEQUAL );
    glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );            // specify implementation-specific hints
  glClearColor(0.0, 0.0, 0.0, 1.0);                     // specify clear values for the color buffers               
}

void keyboard ( unsigned char key, int mousePositionX, int mousePositionY )   
{ 
  switch ( key ) 
  {
    case KEY_ESCAPE:        
      exit ( 0 );   
      break;      

    default:      
      break;
  }
}

int main(int argc, char **argv) 
{
  // set window values
  win.width = 640;
  win.height = 480;
  win.title = "OpenGL/GLUT Example. Visit http://openglsamples.sf.net ";
  win.field_of_view_angle = 45;
  win.z_near = 1.0f;
  win.z_far = 500.0f;

  // initialize and run program
  glutInit(&amp;argc, argv);                                      // GLUT initialization
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );  // Display Mode
  glutInitWindowSize(win.width,win.height);         // set window size
  glutCreateWindow(win.title);                // create Window
  glutDisplayFunc(display);                 // register Display Function
  glutIdleFunc( display );                  // register Idle Function
    glutKeyboardFunc( keyboard );               // register Keyboard Handler
  initialize();
  glutMainLoop();                       // run GLUT mainloop
  return 0;
}
</code></pre>
<p>gist: <a rel="nofollow" target="_blank" href="https://gist.github.com/NAzT/10642267">https://gist.github.com/NAzT/10642267</a></p>
<p>Include &amp; Link libraries then compile!</p>
<pre><code>$ g++ nat.cpp  -I/usr/local/Cellar/freeglut/2.8.1/include  -L/usr/local/Cellar/freeglut/2.8.1/lib -w -framework OpenGL -lGLUT
</code></pre>
<p>to run <code>./a.out</code></p>
<p><img alt="glut-triangle example" src="https://farm8.staticflickr.com/7371/13846252434_9728138c94_d.jpg"/></p>
<p>Ref:</p>
<ul>
<li><a rel="nofollow" target="_blank" href="http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options">http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options</a></li>
</ul>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/cc/curl-library-c-language/" class="wp_rp_title">cURL library กับ ภาษา C</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/cc/compile-c-with-google-c-testing-framework/" class="wp_rp_title">Compile C++ With Google C++ Testing Framework</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/digital-image-processing-2/install-opencv-using-mac-homebre/" class="wp_rp_title">install OpenCV [mac + homebrew]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/what-i-should-study-in-comsci-thammasat-1/" class="wp_rp_title">เลือกเรียนอะไรดี ComSci &#8211; Thammasat (ตอนที่  1)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/using-opengl-and-glut-on-os-x-with-eclipse/" class="wp_rp_title">วิธีการใช้ GLUT บน  MAC ด้วย Eclipse</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/javascipt-scope-chain-variable-resolution-lession/" class="wp_rp_title">ว่ากันเรื่อง Scope ใน JavaScript [ตอนที่ 1]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/drupal-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%b3-views-summary-%e0%b9%83%e0%b8%ab%e0%b9%89%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99%e0%b9%81%e0%b8%9a%e0%b8%9a-jump-menu-dr/" class="wp_rp_title">[drupal] วิธีการทำ views summary ให้เป็นแบบ Jump Menu (drop down)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/facebook-developersments/%e0%b8%ab%e0%b8%b1%e0%b8%94%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-facebook-application-%e0%b8%95%e0%b8%ad%e0%b8%99%e0%b8%97%e0%b8%b5%e0%b9%88-2-javascript-sdk/" class="wp_rp_title">หัดเขียน Facebook Application ตอนที่ 2 (JavaScript SDK)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/pramool-digger/" class="wp_rp_title">โปรขุดบอร์ดประมูล</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/%e0%b8%97%e0%b8%b3%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a-monitor-%e0%b8%81%e0%b8%b2%e0%b8%81%e0%b9%86-%e0%b9%80%e0%b8%ad%e0%b8%b2%e0%b9%84%e0%b8%a7%e0%b9%89%e0%b9%80%e0%b8%81%e0%b9%87%e0%b8%9a%e0%b8%82/" class="wp_rp_title">ทำระบบ monitor กากๆ เอาไว้เก็บข้อมูล cpu/ram/load เครื่อง mac ลง google spreadsheet</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/c/" title="c">c</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/cpp/" title="cpp">cpp</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/freeglut/" title="freeglut">freeglut</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/g/" title="g++">g++</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/gl/" title="gl">gl</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/glut/" title="glut">glut</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/opengl/" title="OpenGL">OpenGL</a><br />]]></content:encoded>
      </item>
      <item>
         <title>วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/</link>
         <description>วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอ [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4431</guid>
         <pubDate>Mon, 14 Apr 2014 14:23:12 +0000</pubDate>
         <content:encoded><![CDATA[<p>วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</p>
<p>ผมใช้แบบนี้ครับ</p>
<pre><code>while true ; do
   if /sbin/ifconfig wlan0 | grep -q "inet addr:" ; then
      sleep 60
   else
      echo "Network Connection Down!"
      /sbin/ifdown --force wlan0
      /sbin/ifup --force wlan0
      sleep 8
      // do sth
   fi;
done
</code></pre>
<p>จะเห็นว่าผมใช้</p>
<pre><code>   
  /sbin/ifdown --force wlan0
  /sbin/ifup --force wlan0
</code></pre>
<p>เพื่อ Restart Network ครับ…. แต่เท่านี้ไม่เพียงพอนะครับ ถ้าอยากรู้ว่าเพราะเหตุใด <a rel="nofollow" title="Raspberry Pi &#x000e15;&#x000e23;&#x000e27;&#x000e08;&#x000e2a;&#x000e2d;&#x000e1a; Network connection &#x000e15;&#x000e2d;&#x000e19;&#x000e17;&#x000e35;&#x000e48; 2" target="_blank" href="http://wp.me/pqpsG-19y">ให้ติดตามตอนที่ 2</a> ครับ</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/" class="wp_rp_title">ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/" class="wp_rp_title">การทดสอบ servo บน bash shell ใน raspberry pi</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/network/" title="network">network</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/rpi/" title="rpi">rpi</a><br />]]></content:encoded>
      </item>
      <item>
         <title>วิธีเปิดใช้งานและ Setup Microduino GPS Shield  (Microduino-NEO-6M)</title>
         <link>http://www.together.in.th/embedded-system/arduino-2/setup-microduino-gps-shield-microduino-neo-6m/</link>
         <description>วิธีเปิดใช้งาน Microduino GPS Shield (Microduino-NEO–6M [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4427</guid>
         <pubDate>Mon, 07 Apr 2014 14:14:03 +0000</pubDate>
         <content:encoded><![CDATA[<p>วิธีเปิดใช้งาน Microduino GPS Shield (Microduino-NEO–6M)</p>
<p>ขั้นตอน</p>
<ol>
<li>ตัด Jumper ให้เป็น Serial1 (D2, D3)</li>
<li>เลือก Buad rate ของ Serial1 เป็น 38400<br />
<img alt="TinyGPS Test Microduino" src="https://farm3.staticflickr.com/2834/13693382295_b20bc7dfdc_z_d.jpg"/></li>
</ol>
<p><img alt="Adafruit Test Microduino" src="https://farm4.staticflickr.com/3786/13693630915_1f2e065c6c_z_d.jpg"/></p>
<h2><span id="more-4427"></span></h2>
<h2>Source Code</h2>
<p>TinyGPS Example</p>
<pre><code>#include &lt;TinyGPS.h&gt;

TinyGPS gps;

static void smartdelay(unsigned long ms);
static void print_float(float val, float invalid, int len, int prec);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &amp;gps);
static void print_str(const char *str, int len);

void setup()
{
  Serial.begin(115200);

  Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();
  Serial.println("Sats HDOP Latitude  Longitude  Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum");
  Serial.println("          (deg)     (deg)      Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail");
  Serial.println("-------------------------------------------------------------------------------------------------------------------------------------");

  Serial1.begin(38400);
}

void loop()
{
  float flat, flon;
  unsigned long age, date, time, chars = 0;
  unsigned short sentences = 0, failed = 0;
  static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

  print_int(gps.satellites(), TinyGPS::GPS_INVALID_SATELLITES, 5);
  print_int(gps.hdop(), TinyGPS::GPS_INVALID_HDOP, 5);
  gps.f_get_position(&amp;flat, &amp;flon, &amp;age);
  print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 10, 6);
  print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 11, 6);
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
  print_date(gps);
  print_float(gps.f_altitude(), TinyGPS::GPS_INVALID_F_ALTITUDE, 7, 2);
  print_float(gps.f_course(), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
  print_float(gps.f_speed_kmph(), TinyGPS::GPS_INVALID_F_SPEED, 6, 2);
  print_str(gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(gps.f_course()), 6);
  print_int(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0xFFFFFFFF : (unsigned long)TinyGPS::distance_between(flat, flon, LONDON_LAT, LONDON_LON) / 1000, 0xFFFFFFFF, 9);
  print_float(flat == TinyGPS::GPS_INVALID_F_ANGLE ? TinyGPS::GPS_INVALID_F_ANGLE : TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
  print_str(flat == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON)), 6);

  gps.stats(&amp;chars, &amp;sentences, &amp;failed);
  print_int(chars, 0xFFFFFFFF, 6);
  print_int(sentences, 0xFFFFFFFF, 10);
  print_int(failed, 0xFFFFFFFF, 9);
  Serial.println();

  smartdelay(1000);
}

static void smartdelay(unsigned long ms)
{
  unsigned long start = millis();
  do 
  {
    while (Serial1.available())
      gps.encode(Serial1.read());
  } while (millis() - start &lt; ms);
}

static void print_float(float val, float invalid, int len, int prec)
{
  if (val == invalid)
  {
    while (len-- &gt; 1)
      Serial.print('*');
    Serial.print(' ');
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val &lt; 0.0 ? 2 : 1); // . and -
    flen += vi &gt;= 1000 ? 4 : vi &gt;= 100 ? 3 : vi &gt;= 10 ? 2 : 1;
    for (int i=flen; i&lt;len; ++i)
      Serial.print(' ');
  }
  smartdelay(0);
}

static void print_int(unsigned long val, unsigned long invalid, int len)
{
  char sz[32];
  if (val == invalid)
    strcpy(sz, "*******");
  else
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i&lt;len; ++i)
    sz[i] = ' ';
  if (len &gt; 0) 
    sz[len-1] = ' ';
  Serial.print(sz);
  smartdelay(0);
}

static void print_date(TinyGPS &amp;gps)
{
  int year;
  byte month, day, hour, minute, second, hundredths;
  unsigned long age;
  gps.crack_datetime(&amp;year, &amp;month, &amp;day, &amp;hour, &amp;minute, &amp;second, &amp;hundredths, &amp;age);
  if (age == TinyGPS::GPS_INVALID_AGE)
    Serial.print("********** ******** ");
  else
  {
    char sz[32];
    sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d ",
        month, day, year, hour, minute, second);
    Serial.print(sz);
  }
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
  smartdelay(0);
}

static void print_str(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i&lt;len; ++i)
    Serial.print(i&lt;slen ? str[i] : ' ');
  smartdelay(0);
}

// Test code for Adafruit GPS modules using MTK3329/MTK3339 driver
//
// This code shows how to listen to the GPS module in an interrupt
// which allows the program to have more 'freedom' - just parse
// when a new NMEA sentence is available! Then access data when
// desired.
//
// Tested and works great with the Adafruit Ultimate GPS module
// using MTK33x9 chipset
//    ------&gt; http://www.adafruit.com/products/746
// Pick one up today at the Adafruit electronics shop 
// and help support open source hardware &amp; software! -ada

#include &lt;Adafruit_GPS.h&gt;

// If you're using a GPS module:
// Connect the GPS Power pin to 5V
// Connect the GPS Ground pin to ground
// If using software serial (sketch example default):
//   Connect the GPS TX (transmit) pin to Digital 3
//   Connect the GPS RX (receive) pin to Digital 2
// If using hardware serial (e.g. Arduino Mega):
//   Connect the GPS TX (transmit) pin to Arduino RX1, RX2 or RX3
//   Connect the GPS RX (receive) pin to matching TX1, TX2 or TX3

// If you're using the Adafruit GPS shield, change 
// SoftwareSerial mySerial(3, 2); -&gt; SoftwareSerial mySerial(8, 7);
// and make sure the switch is set to SoftSerial

// If using software serial, keep these lines enabled
// (you can change the pin numbers to match your wiring):
//SoftwareSerial mySerial(3, 2);

Adafruit_GPS GPS(&amp;Serial1);
// If using hardware serial (e.g. Arduino Mega), comment
// out the above six lines and enable this line instead:
//Adafruit_GPS GPS(&amp;Serial1);

// Set GPSECHO to 'false' to turn off echoing the GPS data to the Serial console
// Set to 'true' if you want to debug and listen to the raw GPS sentences. 
#define GPSECHO  false

// this keeps track of whether we're using the interrupt
// off by default!
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy

void setup()  
{

  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  // also spit it out
  Serial.begin(115200);
  Serial.println("Adafruit GPS library basic test!");

  // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
  GPS.begin(38400);

  // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  // uncomment this line to turn on only the "minimum recommended" data
  //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
  // For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
  // the parser doesn't care about other sentences at this time

  // Set the update rate
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
  // For the parsing code to work nicely and have time to sort thru the data, and
  // print it out we don't suggest using anything higher than 1 Hz

  // Request updates on antenna status, comment out to keep quiet
  GPS.sendCommand(PGCMD_ANTENNA);

  // the nice thing about this code is you can have a timer0 interrupt go off
  // every 1 millisecond, and read data from the GPS for you. that makes the
  // loop code a heck of a lot easier!
  useInterrupt(true);

  delay(1000);
  // Ask for firmware version
  Serial1.println(PMTK_Q_RELEASE);
}

// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
#ifdef UDR0
  if (GPSECHO)
    if (c) UDR0 = c;  
    // writing direct to UDR0 is much much faster than Serial.print 
    // but only one character can be written at a time. 
#endif
}

void useInterrupt(boolean v) {
  if (v) {
    // Timer0 is already used for millis() - we'll just interrupt somewhere
    // in the middle and call the "Compare A" function above
    OCR0A = 0xAF;
    TIMSK0 |= _BV(OCIE0A);
    usingInterrupt = true;
  } else {
    // do not call the interrupt function COMPA anymore
    TIMSK0 &amp;= ~_BV(OCIE0A);
    usingInterrupt = false;
  }
}

uint32_t timer = millis();
void loop()                     // run over and over again
{
  // in case you are not using the interrupt above, you'll
  // need to 'hand query' the GPS, not suggested :(
  if (! usingInterrupt) {
    // read data from the GPS in the 'main loop'
    char c = GPS.read();
    // if you want to debug, this is a good time to do it!
    if (GPSECHO)
      if (c) Serial.print(c);
  }

  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
    // a tricky thing here is if we print the NMEA sentence, or data
    // we end up not listening and catching other sentences! 
    // so be very wary if using OUTPUT_ALLDATA and trytng to print out data
    //Serial.println(GPS.lastNMEA());   // this also sets the newNMEAreceived() flag to false

    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }

  // if millis() or timer wraps around, we'll just reset it
  if (timer &gt; millis())  timer = millis();

  // approximately every 2 seconds or so, print out the current stats
  if (millis() - timer &gt; 2000) { 
    timer = millis(); // reset the timer

    Serial.print("&#92;nTime: ");
    Serial.print(GPS.hour, DEC); Serial.print(':');
    Serial.print(GPS.minute, DEC); Serial.print(':');
    Serial.print(GPS.seconds, DEC); Serial.print('.');
    Serial.println(GPS.milliseconds);
    Serial.print("Date: ");
    Serial.print(GPS.day, DEC); Serial.print('/');
    Serial.print(GPS.month, DEC); Serial.print("/20");
    Serial.println(GPS.year, DEC);
    Serial.print("Fix: "); Serial.print((int)GPS.fix);
    Serial.print(" quality: "); Serial.println((int)GPS.fixquality); 
    if (GPS.fix) {
      Serial.print("Location: ");
      Serial.print(GPS.latitude, 4); Serial.print(GPS.lat);
      Serial.print(", "); 
      Serial.print(GPS.longitude, 4); Serial.println(GPS.lon);

      Serial.print("Speed (knots): "); Serial.println(GPS.speed);
      Serial.print("Angle: "); Serial.println(GPS.angle);
      Serial.print("Altitude: "); Serial.println(GPS.altitude);
      Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
    }
  }
}
</code></pre>
<p>REF:</p>
<ul>
<li><a rel="nofollow" target="_blank" href="https://gist.github.com/NAzT/10017284">Example Source Code</a></li>
<li><a rel="nofollow" target="_blank" href="http://www.microduino.cc/wiki/index.php?title=Microduino-NEO-6M">http://www.microduino.cc/wiki/index.php?title=Microduino-NEO–6M</a></li>
</ul>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/android-programming-2/android-programming-log-route-using-gps-logger/" class="wp_rp_title">เขียนโปรแกรมบน Android ตอน บันทึกเส้นทางด้วย GPS</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/from-javascript-closure-to-objective-c-block/" class="wp_rp_title">ทดลองเล่น Block ใน Objective-C เทียบกับ closure ของ javascript</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/groovy/try-parse-json-using-groovy-java-netbeans/" class="wp_rp_title">[Google Maps Geocoding] ลอง Parse Json ด้วย Groovy + Java (Netbeans) </a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/mpi-program-nonblocking-communication-1/" class="wp_rp_title">การเขียนโปรแกรมโดยใช้ MPI (nonblocking-communication)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/groovy/thai-tokenizer-groovy-not-grails/" class="wp_rp_title">ตัดคำภาษาไทยด้วย Groovy (ไม่ใช้ grails)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/transform-google-docs-spreadsheet-into-json-or-jsonp/" class="wp_rp_title">วิธีการแปลงข้อมูลใน google spreadsheet ให้เป็น json</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/geolocation-programming-2/reverse-geocoding-address-lookup-using-http/" class="wp_rp_title">Reverse Geocoding (Address Lookup) ผ่าน http</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/how-to-go-to-opendream/" class="wp_rp_title">(เส้นทาง)การเดินทางไปโอเพ่นดรีม (Opendream)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/drupal-2/drupal6-%e0%b9%83%e0%b8%8a%e0%b9%89-views-%e0%b8%94%e0%b8%b6%e0%b8%87%e0%b8%a0%e0%b8%b2%e0%b8%9e%e0%b8%88%e0%b8%b2%e0%b8%81-forum-topic-%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%a1%e0%b8%b2/" class="wp_rp_title">[drupal6] ใช้ Views ดึงภาพจาก Forum Topic ออกมา</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/arduino/" title="arduino">arduino</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/gps/" title="gps">gps</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/gps-shield/" title="gps shield">gps shield</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/microduino/" title="microduino">microduino</a><br />]]></content:encoded>
      </item>
      <item>
         <title>วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</title>
         <link>http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/</link>
         <description>บ่อยครั้งที่ผม setup raspberry pi ให้เปิดเครื่องมาปุ๊บ  [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4372</guid>
         <pubDate>Wed, 26 Feb 2014 14:19:29 +0000</pubDate>
         <content:encoded><![CDATA[<p>บ่อยครั้งที่ผม setup raspberry pi ให้เปิดเครื่องมาปุ๊บ รัน nodejs server ทันที.. ไม่ต้องรอใครมาเรียกเลยครับ</p>
<p>ผมเลือกใช้ คำสั่ง screen และ forever ครับ (เรื่อง service ไว้ค่อยมาลองเล่นกันวันหลังนะครับ)</p>
<ul>
<li>คำสั่ง forever เอาไว้ชุบชีวิต nodejs server ให้เกิดใหม่ เวลา server บน Raspberry Pi ตายครับ</li>
<li>คำสั่ง screen เอาไว้สั่ง server ของเราให้รันขึ้นมา ผมจะสั่งให้เปิดมาด้วย detached mode ครับคำสั่งอื่นๆจะได้ไม่ต้องรอครับ</li>
</ul>
<p><span id="more-4372"></span>
<p>เริ่มต้นด้วยการแก้ไข crontab ให้สั่ง <code>crontab -e</code> </p>
<p>แล้วใส่ <code>@reboot /usr/bin/screen -d -m /home/pi/run-server.sh</code> ลงไปเพื่อท้ายไฟล์เพื่อให้รัน Server ของเรา พร้อมกับระบบปฏิบัติการของ Raspberry Pi ครับ</p>
<p>ส่วนในไฟล์ ~/run-server.sh จะมี code แบบนี้ครับ</p>
<pre><code>#!/bin/bash

NODE_JS_HOME=&quot;/opt/node&quot;
PATH=&quot;$PATH:$NODE_JS_HOME/bin&quot;
export PATH

/opt/node/bin/forever start /home/pi/nodefileserver/nat.js
</code></pre>
<p>ทำไม ไม่สั่ง forever ที่ crontab เลย? </p>
<p>เพราะว่าตอนเปิดเครื่องมา ขณะที่ crontab ทำ @reboot ตัว os จะไม่ได้เรียก shell ขึ้นมาทำงาน เลยไม่มีตัวแปร NODE_JS_HOME / PATH ที่เรา export เอาไว้ใน .profile ส่งผลให้มันจะรัน Server ไม่ติดครับ </p>
<p>ผมพิสูจน์โดยสั่ง </p>
<ul>
<li>@reboot echo $(date) &gt;&gt; /home/pi/_cron.log</li>
<li>echo &#8220;.PROFILE $(date)&#8221; &gt;&gt; /home/pi/_profile.log #ใน .profile ครับ</li>
</ul>
<p>More Ref.</p>
<ul>
<li><a rel="nofollow" target="_blank" href="http://stackoverflow.com/questions/20430428/reload-the-profile-file">http://stackoverflow.com/questions/20430428/reload-the-profile-file</a></li>
<li><a rel="nofollow" target="_blank" href="http://serverfault.com/questions/261802/profile-vs-bash-profile-vs-bashrc">http://serverfault.com/questions/261802/profile-vs-bash-profile-vs-bashrc</a></li>
<li><a rel="nofollow" target="_blank" href="http://unix.stackexchange.com/questions/78446/how-to-make-my-tmux-which-starts-via-crontab-reboot-use-bash">http://unix.stackexchange.com/questions/78446/how-to-make-my-tmux-which-starts-via-crontab-reboot-use-bash</a></li>
</ul>
<p>Tags: RaspberryPi, Raspberry Pi, nodejs, forever, crontab, @reboot, raspbian, screen, tmux</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/search-lyric-in-terminal-and-current-itune-playing/" class="wp_rp_title">ค้นหาเนื้อเพลงใน Terminal โดยใช้ nodejs</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/" class="wp_rp_title">การทดสอบ servo บน bash shell ใน raspberry pi</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/reboot/" title="@reboot">@reboot</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/crontab/" title="crontab">crontab</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/forever/" title="forever">forever</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nodejs/" title="nodejs">nodejs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspbian/" title="raspbian">raspbian</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/screen/" title="screen">screen</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/tmux/" title="tmux">tmux</a><br />]]></content:encoded>
      </item>
      <item>
         <title>วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/</link>
         <description>วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OS [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4359</guid>
         <pubDate>Sun, 23 Feb 2014 10:48:03 +0000</pubDate>
         <content:encoded><![CDATA[<p>วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</p>
<p>โดยปกติแล้วถ้า Mac Book จะมี ที่อ่าน SD Card ติดไว้อยู่แล้ว.. แต่ตัวระบบปฏิบัติการไม่สามารถอ่านไฟล์ในระบบของ Raspberry Pi ได้&#8230; </p>
<p>วันนี้ผมมีทางออกให้สำหรับการอ่านไฟล์บนระบบของ Raspberry Pi ครับ</p>
<p>ทางออกนั้นคือเราจะต้องติดตั้ง fuse-ext2 ครับซึ่งสามารถไปดาวน์โหลดกันได้ที่ <a rel="nofollow" target="_blank" href="http://alperakcan.net/projects/fuse-ext2/">http://alperakcan.net/projects/fuse-ext2/</a></p>
<p><span id="more-4359"></span>
<p><code>fuse-ext2 software is based on both ntfs-3g, and ext2fuse packages. all operating system stuff is handled by fuse (linux) / macfuse (mac os x), please be sure that you have valid fuse package before using fuse-ext2.<br />
</code> </p>
<p><img src="http://i2.wp.com/farm6.staticflickr.com/5525/12714104244_17bac4da7e_z_d.jpg" alt="fuse-ext2"/></p>
<p>แต่บางทีเราติดตั้ง fuse-ext2 แล้วก็ยังมองไม่เห็น Partition ของ Raspberry Pi อยู่ดี.. ให้ลองไปดู README กันซะหน่อยครับ..</p>
<pre><code>Fuse-ext2 is a EXT2 Filesystem support for FUSE.

This software is based on both ntfs-3g, and ext2fuse packages.


Dependencies
------------

Fuse-ext2 requires at least Fuse version 2.6.0

- Linux:
    Fuse from http://fuse.sourceforge.net/

- Mac OS:
    Mac Fuse from http://code.google.com/p/macfuse/
</code></pre>
<p>จะเห็นว่าเราจะต้องลง Mac FUSE ก่อนครับ สำหรับผม จะลง FUSE for OS X นะครับ ให้ตามไปโหลดกันที่ <a rel="nofollow" target="_blank" href="http://osxfuse.github.io">http://osxfuse.github.io</a></p>
<p><img src="http://i2.wp.com/farm6.staticflickr.com/5536/12714103824_026b7b21b0_z_d.jpg" alt="FUSE OS X"/></p>
<p><strong>อย่าลืมติ๊ก</strong> MacFUSE Compatibility Layer ด้วยนะครับ พอลงเรียบร้อยก็ บิงโกครับ&#8230; อ่านไฟล์ใน SD Card ของระบบ Raspberry Pi ได้แล้ววว</p>
<p><img src="http://i2.wp.com/farm3.staticflickr.com/2870/12713925933_3e9b6970dc_z_d.jpg" alt="OSX Browsing Ext3"/></p>
<p>Tags: fuse-ext, raspberrypi, linux, fuse, file system</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3-compile-%e0%b9%81%e0%b8%a5%e0%b8%b0%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-bluez-5-27-%e0%b9%83%e0%b8%99-odroid/" class="wp_rp_title">วิธีการ compile และติดตั้ง bluez 5.27 ใน odroid</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/file-system/" title="file system">file system</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/fuse/" title="fuse">fuse</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/fuse-ext/" title="fuse-ext">fuse-ext</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/linux/" title="linux">linux</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a><br />]]></content:encoded>
      </item>
      <item>
         <title>การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/</link>
         <description>บางทีถ้าเราเสียบ RaspberryPi เข้ากับ Router ที่ไม่ได้ s [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4349</guid>
         <pubDate>Wed, 19 Feb 2014 14:20:37 +0000</pubDate>
         <content:encoded><![CDATA[<p>บางทีถ้าเราเสียบ RaspberryPi เข้ากับ Router ที่ไม่ได้ set nameserver ไว้ อาจจะมีปัญหา apt-get หรือคำสั่งที่ต้อง resolve nameserver อาจจะเจอ error ว่า ไม่สามารถ get content ได้ อะไรประมาณนี้ครับ</p>
<p>ในขั้นต้นของการ setup DNS ผมจะเข้าไปไปแก้ไฟล์ <code>/etc/resolv.conf</code> ครับ </p>
<p><code>cat /etc/resolv.conf</code> พอเปิดเข้าไปแล้วก็จะเห็นไฟล์หน้าตาแบบนี้ครับ</p>
<pre><code>nameserver 192.168.1.1
</code></pre>
<p>แต่อนิจจา.. เวลาเรา Reboot ใหม่ nameserver ที่เราเพิ่มเข้าไปใหม่มันจะโดนทับเป็นแบบเดิมอีก.. มันน่าเศร้ายิ่งนัก&#8230;ใครที่เคยเจอปัญหานี้อาจจะเข้าใจดี แต่อย่าเพิ่งตกใจไปครับ..</p>
<p><span id="more-4349"></span>
<p>ปกติแล้วผมจะลง resolvconf ด้วยคำสั่ง <code>sudo apt-get install resolvconf</code> พอลงเสร็จปุ๊บ เราสามารถเข้าไปแก้ไข ใน <code>/etc/resolvconf/resolv.conf.d</code> เพื่อให้ resolvconf ดึงมา generate resolv.conf ตอนเปิดเครื่องก็ได้.. แต่วิธีนี้ยังไม่ถูกต้องนักครับ.. เพราะมันเปาะบาง ดังที่เค้าว่าไว้แบบนี้ครับ</p>
<pre><code># Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
</code></pre>
<p>ให้เราไปแก้ไขไฟล์ <code>sudo vi /etc/network/interfaces</code> ครับ ให้ใส่ option dns-nameservers ไปยัง interface ที่ต้องการครับ ครับออกมาจะได้ประมาณนี้</p>
<pre><code>resolvconf/  resolv.conf
auto lo

iface lo inet loopback
iface eth0 inet dhcp
    dns-nameservers 208.67.222.222 8.8.8.8

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
</code></pre>
<p>หลังจากนั้นสั่ง sudo resolvconf -u เพื่อสั่ง update script ครับ&#8230; ลองไปดูใน code เค้าจะทำฟังก์ชั่นนี้ครับ</p>
<pre><code>update_and_exit()
{
        rm -f &quot;$POSTPONED_UPDATE_FLAGFILE&quot;
        exec run-parts ${1:+--arg=&quot;$1&quot;} ${2:+--arg=&quot;$2&quot;} /etc/resolvconf/update.d
}
</code></pre>
<p>หลังจากนั้นสั่ง <code>sudo ifdown eth0; sudo ifup eth0;</code> เป็นอันเสร็จสิ้นพิธี.. จะได้หน้า resolv.conf ประมาณนี้ครับ</p>
<pre><code># Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
nameserver 208.67.222.222
nameserver 8.8.8.8
</code></pre>
<p>Ref: </p>
<ol>
<li><a rel="nofollow" target="_blank" href="http://manpages.ubuntu.com/manpages/lucid/man8/resolvconf.8.html">http://manpages.ubuntu.com/manpages/lucid/man8/resolvconf.8.html</a></li>
<li><a rel="nofollow" target="_blank" href="http://superuser.com/questions/617796/how-do-i-set-dns-servers-on-raspberry-pi">http://superuser.com/questions/617796/how-do-i-set-dns-servers-on-raspberry-pi</a></li>
<li><a rel="nofollow" target="_blank" href="https://lists.debian.org/debian-devel/2003/07/msg00438.html">https://lists.debian.org/debian-devel/2003/07/msg00438.html</a></li>
</ol>
<p>Tags: raspberrypi, dns, resolv.conf, resolvconf, raspbian, linux, *nix, nameserver</p>
<p></p> 

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/active-network-on-fedora-at-runlevel-1/" class="wp_rp_title">วิธีเปิดใช้งาน Network ใน Single Mode บน Fedora</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/extract-tar-gz-%e0%b8%95%e0%b8%ad%e0%b8%99-wget-on-fly-save-%e0%b8%a5%e0%b8%87-stdout/" class="wp_rp_title">extract .tar.gz ตอน wget (On-Fly &#8212; Save ลง STDOUT) </a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nix/" title="*nix">*nix</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/dns/" title="dns">dns</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/linux/" title="linux">linux</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nameserver/" title="nameserver">nameserver</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspbian/" title="raspbian">raspbian</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/resolv-conf/" title="resolv.conf">resolv.conf</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/resolvconf/" title="resolvconf">resolvconf</a><br />]]></content:encoded>
      </item>
      <item>
         <title>TDD บน Javascript ด้วย Grunt+Simplemocha+Expectations</title>
         <link>http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/tdd-nodejs-module-using-simple-mocha-and-grunt-init/</link>
         <description>เริ่มต้นทำ TDD บน NodeJS สไตล์ Jasmine ง่ายๆด้วยพลังของ [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4326</guid>
         <pubDate>Sat, 15 Feb 2014 10:24:02 +0000</pubDate>
         <content:encoded><![CDATA[<p><img src="http://i0.wp.com/www.together.in.th/blog/wp-content/uploads/2014/02/grunt-logo-300x300.png?resize=300%2C300" alt="Grunt-logo"/></p>
<p>เริ่มต้นทำ TDD บน NodeJS สไตล์ Jasmine ง่ายๆด้วยพลังของ Grunt + Simple mocha + Expecations</p>
<p>ช่วงนี้ผมมีงานที่จะเขียนด้วย Javascript ครับที่สำคัญมีเทสด้วย.. จะได้เขียน Code โง่ๆ กากๆ ได้เต็มที่ครับ<br />
งานแรกที่ต้องทำคือ port <a rel="nofollow" target="_blank" href="http://xively/xively-js">xively-Js</a> มาเป็น nodejs module ครับ อยากใช้ Grunt เป็น Task Runner ครับ </p>
<p>แต่ถ้าจะใช้ Grunt ก็ต้องมี Setting file ครับซึ่งก็มี <a rel="nofollow" target="_blank" href="http://gruntjs.com/project-scaffolding">grunt-init</a> ช่วยอยู่<br />
แต่ไม่มีตัวทำออกมาแล้วหน้าตาคล้ายกับเทส Jasmine เลยครับ (เพราะว่า xively-js ใช้ jasmine) ผมขี้เกียจเขียนใหม่อยากจะไปเอาเทสมาเลย.. สุดท้ายเลยต้องทำ <a rel="nofollow" target="_blank" href="https://github.com/NAzT/grunt-init-node">grunt-init-simplemocha</a> ขึ้นมา ซึ่งเป็นตัวที่ fork มาจาก <a rel="nofollow" target="_blank" href="https://github.com/gruntjs/grunt-init-node">grunt-init-node</a> ครับ แต่จะเพิ่มความสามารถของ Grunt task เข้าไปอันนึงคือ grunt simplemocha ครับ เรามาดูวิธีการติดตั้งกันเลยครับ ลง grunt &amp; grunt-init ให้เรียบร้อยก่อนนะครับ</p>
<p><span id="more-4326"></span>
<ol>
<li>
<p>ติดตั้ง grunt-init-simplemocha กันก่อนครับด้วยคำสั่ง <code>git clone git@github.com:NAzT/grunt-init-node.git ~/.grunt-init/simplemocha</code></p>
</li>
<li>
<p>สร้าง directory ของโปรเจ็ค แล้วสั่ง <code>grunt-init simplemocha</code> ครับ&#8230; จะได้หน้าตาแบบนี้<br />
<img src="http://i1.wp.com/farm4.staticflickr.com/3783/12536482823_2b5420e8f1_c.jpg" alt="Grunt-init Simplemocha"/></p>
</li>
<li>
<p>ลง package ที่จำเป็นโดยการสั่ง <code>npm install</code><br />
<img src="http://i0.wp.com/farm8.staticflickr.com/7454/12536483403_e8ecbbe9f3_c.jpg" alt="Grunt-init npm install"/></p>
</li>
<li>
<p>สั่ง <code>grunt</code> หรือ <code>grunt simplemocha</code> เป็นอันเสร็จพิธีครับ<br />
<img src="http://i0.wp.com/farm4.staticflickr.com/3796/12536361255_88f554e736_c.jpg" alt="Grunt-test"/></p>
</li>
</ol>
<p>หน้าตา Test File จะเป็นแบบนี้ครับ</p>
<pre><code>'use strict';

require('expectations'); // exports a global, so use anywhere

var sinon = require('sinon');
var request = require('request');
var simplemocha_pi = require('../lib/simplemocha-pi.js');

describe(&quot;awesome&quot;, function () {
    beforeEach(function () {
        this.awesome = simplemocha_pi.awesome();
        sinon.spy(request, 'get');
        sinon.spy(request, 'put');
        this.callback = sinon.spy();
    });

    it(&quot;should be awesome&quot;, function() {
      expect(simplemocha_pi.awesome()).toEqual('awesome');
      expect(this.awesome).toEqual('awesome');
    });

    afterEach(function () {
        request.get.restore();
        request.put.restore();
    });

});
</code></pre>
<p>งานนี้ผมเอาไปใช้กับ <a rel="nofollow">RaspberryPi</a> เช่นเคยครับ.. ไว้เจอกันใหม่นะคร้าบบบ</p>
<p>Tags: grunt, grunt-init, grunt-init-simplemocha, nodejs, xively,</p>
<p></p> 

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/search-lyric-in-terminal-and-current-itune-playing/" class="wp_rp_title">ค้นหาเนื้อเพลงใน Terminal โดยใช้ nodejs</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/javascript-unit-test-in-nodejs/" class="wp_rp_title">ทำ unit test ใน javascript แบบ [กากๆ, เบาๆ]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/realtime-lyric-itunes-nodejs-applescript-socket-io-angularjs/" class="wp_rp_title">ดูเนื้อเพลงที่กำลังเล่นใน itunes แบบ realtime</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/ruby/%e0%b8%aa%e0%b8%b1%e0%b9%88%e0%b8%87-by-word-%e0%b8%82%e0%b8%b6%e0%b9%89%e0%b8%99%e0%b8%a1%e0%b8%b2%e0%b8%97%e0%b8%b3%e0%b8%87%e0%b8%b2%e0%b8%99%e0%b8%9e%e0%b8%a3%e0%b9%89%e0%b8%ad%e0%b8%a1-template/" class="wp_rp_title">[jekyll] สั่ง By Word ขึ้นมาทำงานพร้อม Template และชื่อ File จาก Rake Task</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/pre-github-command-blog-from-terminal/" class="wp_rp_title">[Pre] GitHub Command (Blog From Terminal)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/bdd-framework-%e0%b8%aa%e0%b8%b3%e0%b8%ab%e0%b8%a3%e0%b8%b1%e0%b8%9a-javascript/" class="wp_rp_title">BDD framework สำหรับ javascript</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/grunt/" title="grunt">grunt</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/grunt-init/" title="grunt-init">grunt-init</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/grunt-init-simplemocha/" title="grunt-init-simplemocha">grunt-init-simplemocha</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nodejs/" title="nodejs">nodejs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/xively/" title="xively">xively</a><br />]]></content:encoded>
      </item>
      <item>
         <title>การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</title>
         <link>http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/</link>
         <description>การ Install NodeJs บน RaspberryPi เกริ่นก่อน การ Instal [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4307</guid>
         <pubDate>Sun, 09 Feb 2014 02:12:14 +0000</pubDate>
         <content:encoded><![CDATA[<p><img height="375px" width="606px" src="https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-ash3/t1/534280_587778804567249_855301900_n.jpg" alt="RaspberryPi"/></p>
<h2>การ Install NodeJs บน RaspberryPi</h2>
<h3>เกริ่นก่อน</h3>
<p>การ Install NodeJs บน Raspberry Pi นั้นทำได้หลายแบบครับ</p>
<ol>
<li>ติดตั้งจาก source code แบบนี้ว่ากันง่ายๆ ก็คือเอามา compile เอาเองครับ (จะบน RaspberryPi หรือจะ Cross compile ที่เครื่องอื่นก็ว่ากันไปครับ)</li>
<li>ติดตั้งจาก Binary จาก ผู้พัฒนา NodeJs ครับ</li>
</ol>
<p><span id="more-4307"></span>VIDEO ประกอบการ SETUP ครับ</p>
<p></p> 
<p>ช่วงนี้ผมใช้ NodeJs บน RaspberryPi เยอะ วันนี้ก็ก็เลยจะพูดถึงการติดตั้งแบบสะดวก รวดเร็ว พร้อมใช้งาน แบบเร็วที่สุดนะครับ </p>
<h3>การเลือก Version NodeJs</h3>
<p>ให้เลือกได้ตามใจ ข้อแค่ให้เป็น Linux-Arm-Pi ก็พอครับ โดยเข้าไปเลือกที่ <a rel="nofollow" target="_blank" href="http://nodejs.org/dist/">NodeJS dist</a></p>
<h3>การติดตั้งบน Raspberry Pi</h3>
<p>ก่อนอื่นเลยให้สั่ง </p>
<pre><code>sudo apt-get update
sudo apt-get upgrade
</code></pre>
<p>ตามระเบียบครับ หลังจากนั้นอาจจะติดตั้ง Package ที่อยากจะใช้ครับ.. สำหรับผมจะติดตั้ง <code>sudo apt-get install axel resolvconf vim</code></p>
<p>หลังจากนั้นก็โหลด NodeJs มาไว้บน RaspberryPi ครับ</p>
<pre><code>mkdir ~/download; cd download
wget http://nodejs.org/dist/v0.10.22/node-v0.10.22-linux-arm-pi.tar.gz -O- | tar xvz
</code></pre>
<p>หลังจากนั้นก็เริ่มการติดตั้งครับ โดยให้สั่ง</p>
<pre><code>sudo mkdir /opt/node
sudo cp -Rv node-v0.10.22-linux-arm-pi/* /opt/node
vi ~/.profile
</code></pre>
<p>ในไฟล์ .profile ให้ใส่</p>
<pre><code>NODE_JS_HOME=&quot;/opt/node&quot;
PATH=&quot;$PATH:$NODE_JS_HOME/bin&quot;
export PATH
</code></pre>
<p>แล้วสั่ง <code>source ~/.profile</code> เป็นอันเรียบร้อยครับ</p>
<h3>แต่จะมีปัญหาเรื่องการสั่ง sudo npm บน Raspberry Pi ไม่ได้</h3>
<p>ให้แก้ไขโดยสั่ง <code>sudo visudo</code> แล้ว เพิ่มบรรทัดตามข้างล่างนี้ลงไปครับ</p>
<pre><code>#add
Defaults        exempt_group=&quot;pi&quot;
</code></pre>
<h3>Terminal จะได้ประมาณนี้ครับ</h3>
<pre><code>sudo apt-get update
sudo apt-get upgrade

sudo apt-get install axel resolvconf vim

mkdir ~/download; cd download

wget http://nodejs.org/dist/v0.10.22/node-v0.10.22-linux-arm-pi.tar.gz -O- | tar xvz
sudo mkdir /opt/node
sudo cp -Rv node-v0.10.22-linux-arm-pi/* /opt/node


vi ~/.profile
## PASTE CONTENT
source ~/.profile
sudo visudo
</code></pre>
<p>เรียบร้อยแล้วครับ การติดตั้ง NodeJs version 0.10.22 บน Raspberry Pi ครับ เรียกได้ว่าเป็น</p>
<p>The most quickest and easiest to install nodejs &#038; npm on the raspberry pi</p>
<p>Tag: NodeJs, RaspberryPi, Linux, ARM, npm, installation</p>
<p></p> 
<p>ท้ายที่สุด ถ้าสนใจ Implement งานบน RaspberryPi ติดต่อผมได้พี่ <a rel="nofollow" target="_blank" href="https://www.facebook.com/together.in.th">เพจครับ</a></p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/tdd-nodejs-module-using-simple-mocha-and-grunt-init/" class="wp_rp_title">TDD บน Javascript ด้วย Grunt+Simplemocha+Expectations</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nix/" title="*nix">*nix</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/arm/" title="ARM">ARM</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/installation/" title="installation">installation</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/linux/" title="linux">linux</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nodejs/" title="nodejs">nodejs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/npm/" title="npm">npm</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a><br />]]></content:encoded>
      </item>
      <item>
         <title>ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/</link>
         <description>ควบคุม Rasberry Pi สั่งงาน PiFace ผ่าน Internet เปิดฉาก [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/?p=4300</guid>
         <pubDate>Sat, 08 Feb 2014 14:47:14 +0000</pubDate>
         <content:encoded><![CDATA[<h2>ควบคุม Rasberry Pi สั่งงาน PiFace ผ่าน Internet</h2>
<p>เปิดฉากมาก็บล็อกกันด้วย VDO ซะเลยครับ เมื่อก่อนตอนเล่น Raspberry Pi ใหม่ๆ โจทย์ที่อยากแก้สุดๆเลยก็คืออยากสั่งงาน​ Raspberry Pi ผ่าน Internet อย่างเช่น เปิด ปิดไฟ ผ่านมือถืออะไรพวกนี้ครับ</p>
<p>ตัวนี้เป็นการทดลองคุม Raspberry Pi และ PiFace โดยใช้หน้าบ้านเป็น AngularJS + NodeJs + Socket.io แล้วติดต่อกันผ่านทาง RabbitMQ ครับ</p>
<p>VDO:</p>
<p></p> 
<pre><code>To POC that I can control my raspberry pi from another network!
<strong>Architecture</strong>
---- angularjs + nodejs + socket-io [hosted by cloudfoundry] 
---- rabbitmq broker [amazon ec2] 
---- python PiFace on the Raspberry Pi
</code></pre>
<p><a rel="nofollow" target="_blank" href="http://www.youtube.com/watch?v=rTubSjZDW-g">Youtube: Control Raspberry Pi &amp; PiFace from the internet</a></p>
<p>ตัวนี้เป็นทดสอบการ Control Raspberry Pi และ PiFace ผ่าน 3g และเป็น Native iOS App ด้วยครับ<br />
งานนี้ใช้ Pubnub บน Raspberry Pi และฝั่งมือถือ(Android+iOs) ผมใช้ Corona + PubNub ครับ</p>
<hr />
<p>VDO: </p>
<p></p> 
<pre><code>Using Corona and PubNub for the communication.
</code></pre>
<p><a rel="nofollow" target="_blank" href="http://www.youtube.com/watch?v=nFMJacYNKNQ">Youtabe: A Real-time PiFace relay controller [Native iOS and 3g network] </a></p>
<hr />
<p>VDO:</p>
<p></p> 
<pre><code>ทดสอบ i/o/relay/led/momentary button บน PIFACE ครับ

<ul>
<li>มี input 8 ช่อง </li>
<li>output 8 ช่อง </li>
<li>ปุ่มแบบกดติด ปล่อยดับ 4 ตัว </li>
<li>relay สองตัว</li>
<li>ไฟ LED บนบอร์ด 8 อัน</li>
</ul>

ทำ script ง่ายๆ ให้กด button แล้วให้แสดงไฟสองอัน ตัวที่ [i, n - i]

<ul>
<li>เสียงติ๊กๆ เป็นเสียงของ relay </li>
<li>หลอดไฟ LED ที่ต่อออกมาข้างนอกเชื่อมกับ relay
</code></pre>
</li>
</ul>
<p><a rel="nofollow" target="_blank" href="http://www.youtube.com/watch?v=Rf8Erdj2iBI">Youtube: ทดสอบ input, output, relay, led บน piface </a></p>
<p>&lt;</p>
<p>p&gt;สนใจติดต่อผมได้ทาง <a rel="nofollow" target="_blank" href="http://facebook.com/together.in.th">Facebook Page</a> นะครับ<br />
Tag: raspberry pi, nodejs, socketio, piface, corona, pubnub, angularjs, rpi, rabbitmq, python, amazon ec2</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/realtime-lyric-itunes-nodejs-applescript-socket-io-angularjs/" class="wp_rp_title">ดูเนื้อเพลงที่กำลังเล่นใน itunes แบบ realtime</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87-vnc-server-remote-desktop/" class="wp_rp_title">การติดตั้ง VNC Server (Remote Desktop)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/" class="wp_rp_title">ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/amazon-ec2/" title="amazon ec2">amazon ec2</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/angularjs/" title="angularjs">angularjs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/corona/" title="corona">corona</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/nodejs/" title="nodejs">nodejs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/piface/" title="piface">piface</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/pubnub/" title="pubnub">pubnub</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/python/" title="python">python</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/rabbitmq/" title="rabbitmq">rabbitmq</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/rpi/" title="rpi">rpi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/socketio/" title="socketio">socketio</a><br />]]></content:encoded>
      </item>
      <item>
         <title>PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/</link>
         <description>รู้จักกับ PiFace Output คราวที่แล้วเรารู้จัก PiFace ในต [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/blog/?p=4144</guid>
         <pubDate>Mon, 15 Apr 2013 12:25:10 +0000</pubDate>
         <content:encoded><![CDATA[<h2>รู้จักกับ PiFace Output</h2>
<p>คราวที่แล้วเรารู้จัก PiFace ในตอนที่ชื่อว่า <a rel="nofollow" target="_blank" href="http://www.together.in.th/blog/piface-%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87/">“PiFace ภาคติดตั้ง”</a> กันไปแล้ว จริงๆที่ว่าไว้ใน Blog ตอนนั้นว่าตอนต่อไปจะเป็นเรื่อง Input ผมขอสลับเรื่อง Output มาแทนนะครับ น่าจะง่ายกว่า…</p>
<p>ผมคิดอยู่หลายตลบว่าจะเล่นกับ PiFace output ยังไงดี… จนมาลงเอยด้วยการคุม output ด้วยภาษาต่างๆเนี่ยแหละ.. แต่ก่อนอื่นก็ต้องเข้าใจการต่อ output ของ PiFace ก่อนนะครับ..</p>
<h3>Output ของ PiFace</h3>
<p>ปกติแล้วถ้าเราเอา gpio บน raspberry pi มาทำ output เวลาเราสั่ง gpio pin ให้เป็นสถานะ high ไฟก็จะวิ่งออกจาก pin นั้นไปสู่ ground แต่บน PiFace ไม่ใช่แบบนั้นครับ… PiFace จะทำตัวตรงกันข้ามกันครับคือ เมื่อเรา set state ของ output เป็น high ปุ๊บ.. ตัว output มันจะยอมให้กระแสไฟไหลผ่าน ซึ่งก็คือมันทำตัวเองเป็น ground ครับ ที่เป็นแบบนี้ก็เพราะ output ของ PiFace ใช้ chip ULN2803A เป็นแบบ open-collector (Darlington transistor array chip) มันจะยอมให้แรงดันไฟฟ้าที่สูงๆไหนผ่านได้… ลองดูใน <a rel="nofollow" target="_blank" href="http://www.datasheetcatalog.org/datasheets/105/366825_DS.pdf">datasheet</a> แล้วเข้าใจว่ารับได้สูงสุด 50v ครับ.. แต่ที่แน่ๆในรูปตัวอย่างในเอกสารของ PiFace เขียนไว้ว่า 20v ก็ยังไหวครับ</p>
<pre style="overflow:auto;height:120px;word-wrap:break-word;padding:10px;background:#eee;">The 8 digital outputs are buffered through the ULN2803A open-collector chip. When actuated the outputs sink (all currnt to flow to ground), think of it as a switch with one terminal connected to ACTIVATE ground. To connect a circuit you must connect on end of the output to 5v and the other to an output pin. When the output pin COLLECTOR is set high the current will go from 5v to the grounded output pin.</pre>
<p>มาเข้าเรื่อง code กันเลยละกันนะครับ</p>
<h4>ภาษา C</h4>
<p>สมมติว่าลง lib piface เรียบร้อยแล้วนะครับ (ใครลงไม่ได้ให้ติดต่อมาที่ <a rel="nofollow" target="_blank" href="https://www.facebook.com/together.in.th">Facebook</a> ได้เลยครับ) การทดสอบนั้นให้เข้าไปที่ directory: piface/c/examples หลังจากนั้นสั่ง ls ดู จะพบไฟล์ .c ทั้งหมด 3 ไฟล์ นั่นก็คือ</p>
<ol>
<li>board_reset.c</li>
<li>the_amazing_led_show.c</li>
<li>input_reader.c</li>
</ol>
<p>เราลองมาดู code ของ board_reset.c กันก่อนเลยนะครับ</p>
<p><span id="more-4144"></span></p> 
<p>ให้ compile ด้วยคำสั่ง make board_reset แล้วลองรันโปรแกรมนี้ด้วยคำสั่ง ./board_reset ครับ.. โปรแกรมนี้มันจะ clear output ทุกตัวให้อยู่ใน logic low ครับ ซึ่งหมายถึงปิดการทำงานของ output port ทุกตัว.. กระบวนการพวกนี้เกิดจากคำสั่งไหนกัน?<br />
จาก code ข้างบนเราพบว่ามีการเรียกใช้แค่ 2 functions เองก็คือ pfio_init กับ pfio_deinit … ผมเลยลองไล่ไปดู code ของ piface ที่อยู่ในไฟล์ src/piface/pfio.c มองหา function pfio_deinit(void) เราจะพบว่า มีการสั่งให้ close(spi-&gt;fd) กับ free(spi) เพื่อปลดปล่อย memory ที่จองเอาไว้เฉยๆ ด้วย code หน้าตาแบบนี้ครับ</p>
<pre><code>char pfio_deinit(void)
{
    close(spi-&gt;fd);
    free(spi);
    return 0;
}
</code></pre>
<p>หลังจากนั้นเราก็ไปดูที่ฟังก์ชั่น pfio_init(void) ครับ จะเห็นว่ามีการ allocate พื้นที่ให้ตัวแปร spi (ด้วยคำสั่ง malloc) มีการ setup port direction (บรรทัดที่ 64 &#8211; 70) แล้วบรรทัดที่สนใจสุดๆก็คือ บรรทัดที่ 73 &#8211; 75 ครับ มีการสั่งให้ output ทุกตัวเป็น logic low</p>
<pre><code>// initialise all outputs to 0
int i;
for (i = 1; i &lt;= 8; i++)
   pfio_digital_write(i, 0);
</code></pre>
<p>Bingo! แสดงว่าทุกครั้งที่เราสั่ง pfio_init(); output ทุกตัวของเราจะถูกสั่งปิด… (กระบวนการแบบนี้ library piface ใน python ก็เหมือนกันเลยครับ)</p>
<p>หลังจากนั้นมาต่อกันที่ตัวอย่างที่น่าสนใจตัวถัดไปครับ นั่นก็คือ… the_amazing_led_show.c สั่ง compile มันด้วยคำสั่ง make the_amazing_led_show หลังจากนั้นก็รันด้วยคำสั่ง ./the_amazing_led_show ครับ ผลการทดสอบก็จะเป็นไปดัง vdo นี้ครับ</p>
<p></p> 
<p>&nbsp;</p>
<p>ใน code จะมีการเรียกใช้ฟังก์ชั่น [0x1, 0xc, 0xd, 0x3, 0x1, 0x2, 0x4, 0x5, 0x6, 0x7] แปลงเป็นฐาน 10 จะได้ [1, 12, 13, 3, 1, 2, 4, 5, 6, 7] ซึ่งมันคือ [‘1000000’, ‘11000000’, ‘11010000’, ‘11000000’, ‘10000000’, ‘10000000’, ‘10000000’, ‘10100000’, ‘11000000’, ‘11100000’] ในรูปของเลขฐานสอง แต่ละบิตแทน output 1 ช่องครับ (มีทั้งหมด 8 บิต 8 ช่อง) แต่ให้สังเกตคำสั่งในการสั่ง output ของโปรแกรมนี้ครับ… เค้าจะใช้คำสั่ง pfio_write_output แทน pfio_digital_write(pin, state) ผมชอบใช้คำสั่งนี้มากกว่า digital_write ครับ เพราะว่าถ้าผมต้องการ set ให้ทุก output pin มี logic เป็น low ผมก็แค่สั่ง write_output(0x00) ครับ ถ้ามิเช่นนั้นผมจะต้องสั่งผ่าน แบบนี้ครับ…</p>
<pre><code>// initialise all outputs to 0
int i;
for (i = 1; i &lt;= 8; i++)
   pfio_digital_write(i, 0);
</code></pre>
<p>เอาล่ะพอหอมปาก หอมคอ เท่านี้ก่อนนะครับสำหรับภาษา C</p>
<h4>Python</h4>
<p>สำหรับภาษา python ผมแนะนำชุดคำสั่ง หรือ template ให้ติดไว้ในหัวแค่นี้ครับ..</p>
<p>template นี้จำไว้เบย,, พอกินเลยครับ</p>
<p>&nbsp;</p>
<p>จริงๆ python lib ของ piface มีอะไรจุกจิกให้ใช้เยอะมาก แต่ผมจำแค่ pfio.write_output กับ pfio.digital_write พอแล้ว…</p>
<p>ทดสอบความเหมือนกันระหว่าง c และ python ครับ… ผมจะลอง port code จาก the_amazing_led_show.c มาเป็น version python นะครับ…</p>
<p>&nbsp;</p>
<p>ใช้เหมือนกันเลย! ไม่ซับซ้อนครับ ชาบู~</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-3g-dongle-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%97%e0%b8%b1%e0%b9%89%e0%b8%87-ais-%e0%b9%81%e0%b8%a5%e0%b8%b0-truemove-h-%e0%b8%84%e0%b8%a3%e0%b8%b1/" class="wp_rp_title">ทดสอบ 3G dongle บน Raspberry Pi ทั้ง AIS และ Truemove H ครับ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/" class="wp_rp_title">การทดสอบ servo บน bash shell ใน raspberry pi</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/electronics/" title="electronics">electronics</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/piface/" title="piface">piface</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a><br />]]></content:encoded>
      </item>
      <item>
         <title>PiFace ภาคติดตั้ง</title>
         <link>http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/</link>
         <description>สืบเนื่องมากจากการร่วมกิจกรรมแจก PiFace ของ RaspberryPi [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/blog/?p=4116</guid>
         <pubDate>Tue, 26 Feb 2013 14:57:18 +0000</pubDate>
         <content:encoded><![CDATA[<p><img src="https://lh4.googleusercontent.com/-z51hu1ZDD84/UShJ4ZXqf2I/AAAAAAAAHeA/eL4k3enXM20/s606/Screen+Shot+2556-02-23+at+11.40.30+AM.png" alt="PiFace"/>
<p>สืบเนื่องมากจากการร่วมกิจกรรมแจก PiFace ของ <a rel="nofollow" target="_blank" href="https://www.facebook.com/RaspberryPiThai">RaspberryPiThai</a> ตอนได้มาก็รีบอ่านคู่มือครับ อ่านทุกวันเลย แรกๆเจอแต่ keyword เต็มไปหมดเลย แต่ก็ค่อยๆทำความเข้าใจไปเรื่อยๆ เก็บเล็กผสมน้อย หมั่นทดลองไปเรื่อยๆ</p>
<p>เอาล่ะ เข้าประเด็นกันเสียที..</p>
<p>ก่อนอื่นพูดถึง spec แบบหยาบๆของ PiFace ก่อนเลยนะครับ ซึ่งประกอบด้วยส่วนหน่วยต่างๆดังนี้ครับ</p>
<ul>
<li>8 digital inputs</li>
<li>8 digital open-collector outputs [ ULN2803A ]</li>
<li>4 tactile switches [สวิชแบบ กดติด-ปล่อยดับ]</li>
<li>2 changeover relays</li>
<li>8 LED indicators</li>
</ul>
<p><span id="more-4116"></span><img src="https://lh4.googleusercontent.com/-JlQ_BNFFqEE/UShJ4dIPuSI/AAAAAAAAHd8/nieejD9zDvo/s618/Screen+Shot+2556-02-23+at+11.45.40+AM.png" alt="piface-board-overview"/>
<p>เมื่อได้ PiFace มาปุ๊บ ก็ต้องทำให้มันใช้ได้ก่อน.. ซึ่งอันดับแรก เราโหลด Module SPI ขึ้นมาใช้งานก่อนครับ ซึ่งให้พิมพ์คำสั่งนี้ครับ</p>
<pre><code># modprobe spi-bcm2708 </code></pre>
<p>ถ้าต้องการให้โหลดขึ้นมาทุกครั้งที่เปิดเครื่องให้ทำตาม <a rel="nofollow" target="_blank" href="http://on.fb.me/VWlG1r">RaspberyPiThai Note</a> ได้เลยครับ หรือจะดูรายละเอียดเน้นๆเลยก็ได้ที่ <a rel="nofollow" target="_blank" href="http://www.farnell.com/datasheets/1684425.pdf">Farnell Documentation</a> ครับ</p>
<p>ส่วนขั้นตอนถัดไปก็ติดตั้งด้วยคำสั่ง </p>
<pre><code># wget -O - http://pi.cs.man.ac.uk/download/install.txt | bash </code></pre>
<p>เสร็จแล้วลองเขียนโปรแกรมเพื่อทดสอบ input / output / switch / relay ครับ </p>
<p>แต่ว่า switch มีทั้งหมดแค่ 4 อัน แต่มี output/led ทั้งหมด 8 อัน ดังนั้นเราจึงเขียนโปรแกรมให้ switch 1 อัน ควบคุม output 2 อันครับ คู่ของ outputจะเป็น (i, 9-i) ครับ ผลการทำงานจะเป็นแบบใน vdo ข้างล่างครับ</p>
<p></p> 
<p>หลัังจากดู vdo แล้ว มีจุดนึงที่ผมยังไม่ได้กล่าวถึงครับ เนื่องจาก เนื่องจาก Relay บน Piface มีทั้งหมด 2 ตัว แต่ดันเชื่อมกับ output 2 ตัวแรกด้วย ดังนั้น จากโปรแกรมข้างต้น ถ้าผมกด switch หมายเลข 1 แล้ว output 1 และ relay 1 จะทำงานพร้อมกัน (จะมีเสียงติ๊กดังขึ้น) ซึ่งจะเห็นได้เมื่อว่าผมกด switch อันแรกแล้ว LED ตรง breadboard ที่ต่อกับ relay 1 จะสว่างด้วย code จะเป็นประมาณนี้ครับ</p>
<p> 
<p>แล้วเราก็ทดลองเพิ่มขึ้นอีกนิด โดยการเขียนโปรแกรมควบคุมการเปิด/ปิดของ output ทั้ง 8 ครับ ซึ่งผมใช้ทั้งหมด 4 บิต ในการแทนค่าครับ โดยที่ 3 บิตแรกแทน output ทั้งหมด 2^3 = 8 ช่อง ส่วนบิตสุดท้ายเป็นบิตสถานะครับ 1 เปิด 0 ปิด ผลการทำงานเป็นอย่างใน vdo ข้างล่างนี้ครับ</p>
<p></p> 
<p>ส่วน code เป็นแบบนี้ครับ</p>
<p> 
<p>การเขียนโปรแกรมนั้นใช้ได้ทั้งภาษา python, c และ scratch ครับผม. แต่ผมลองแค่ python กับ c ครับ ส่วนรายละเอียดไว้ค่อยมาพูดถึงอีกทีครับ. </p>
<p>กลับมาที่ spec ของ PiFace แบบละเอียดขึ้นมาอีกนิดนึงครับ PiFace ใช้ pin บน raspberry pi ดังนี้ครับ </p>
<ol>
<li>3v3</li>
<li>5v</li>
<li>0v</li>
<li>SPI MOSI</li>
<li>SPI MISO</li>
<li>SPI SCLK</li>
<li>SPI10 CE0 N</li>
<li>SPI10 CE1 N</li>
</ol>
<p>จะเห็นว่า ใช้แค่ SPI เองครับ&#8230; ที่เหลือ PiFace ปิดไว้หมดเลย.. พอดีผมมี slice of pi/o อยู่ตัวนึง ซึ่งมี SPI slot ออกมาครบเลย ผมเลยลองเอา PiFace มาต่อสายแล้วค่อยเสียบกับ SoP/o ครับ แล้วก็ยังทำงานได้เหมือนเดิมเป๊ะครับ มีรูปประกอบอยู่ข้างล่างครับ</p>
<p>จับ PiFace มาหงายท้อง.. ใช้ pin แค่เนี๊ยะเอง <img src="https://lh5.googleusercontent.com/-CJ-eNEYp_Kw/USsacxlnMBI/AAAAAAAAHeo/vmU_aCp2RJU/s627/photo+%287%29.JPG" alt="&#x000e08;&#x000e31;&#x000e1a; PiFace &#x000e21;&#x000e32;&#x000e2b;&#x000e07;&#x000e32;&#x000e22;&#x000e17;&#x000e49;&#x000e2d;&#x000e07;"/></p>
<p>เสียบเข้ากับ SoP/o <img src="https://lh4.googleusercontent.com/-89Yu9TSQ1hE/USsiJbqVsvI/AAAAAAAAHfY/NbODeJOxpiM/s840/photo+%2810%29.JPG" alt="&#x000e40;&#x000e2a;&#x000e35;&#x000e22;&#x000e1a;&#x000e40;&#x000e02;&#x000e49;&#x000e32;&#x000e01;&#x000e31;&#x000e1a; SoP/o"/></p>
<p>PiFace โดนไล่ที่ <img src="https://lh4.googleusercontent.com/-ovmFXibK_3I/USsbyhbIqcI/AAAAAAAAHe0/oMvz4fFpQFU/s840/photo+%289%29.JPG" alt="PiFace &#x000e42;&#x000e14;&#x000e19;&#x000e44;&#x000e25;&#x000e48;&#x000e17;&#x000e35;&#x000e48;"/></p>
<p>ตอนถัดไปเราจะมาลองทดสอบ digital input กันครับ&#8230; โดยที่เราจะลองต่อ PIR motion sensor (ตรวจจับความเคลื่อนไหว) เข้ากับ PiFace เล่นกันดูนะครับ จะลองทั้งภาษา c และ python ครับ</p>
<p> แหล่งข้อมูลเพิ่มเติม​:
<p><a rel="nofollow" target="_blank" href="https://github.com/thomasmacpherson/piface">https://github.com/thomasmacpherson/piface</a></p>
<p><a rel="nofollow" target="_blank" href="http://www.farnell.com/datasheets/1684425.pdf">Farnell Documentation</a></p>
<p><a rel="nofollow" target="_blank" href="https://docs.google.com/document/d/145TkSMwnPAJaqKMLxdvD8aGULQ8UgIIU3hg-JAKwAa0/edit">Getting Started</a></p>
<p><a rel="nofollow" target="_blank" href="https://docs.google.com/folder/d/0B-UAZ9CyJCLGQjJ3RDlqa2pqaDg/edit">Documentation</a></p>
<p> ไว้สนุกกันใหม่คราวหน้ากันนะคร้าบบ</p>
<p>ปล. ภาพประกอบทั้งหมดมาจากในคู่มือนะคร้าบบ</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1-raspberry-pi-%e0%b9%80%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b8%9b%e0%b8%b4%e0%b8%94%e0%b9%84%e0%b8%9f-%e0%b8%9c%e0%b9%88%e0%b8%b2%e0%b8%99-internet/" class="wp_rp_title">ควบคุม Raspberry Pi / เปิดปิดไฟ ผ่านมือถือ ผ่าน Internet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/basic-control-piface-using-c-and-python/" class="wp_rp_title">PiFace ภาคสอง ตอน: รู้จักกับ PiFace Output</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wif-2/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 2]</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/the-most-quickest-and-easiest-to-install-nodejs-npm-on-the-raspberry-pi/" class="wp_rp_title">การติดตั้ง NodeJs บน RaspberryPi แบบด่วนจี๋</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%a3%e0%b8%a7%e0%b8%88%e0%b8%aa%e0%b8%ad%e0%b8%9a%e0%b8%a7%e0%b9%88%e0%b8%b2-raspberry-pi-%e0%b8%95%e0%b9%88%e0%b8%ad-wifi/" class="wp_rp_title">วิธีการตรวจสอบว่า Raspberry Pi ต่อ WIFI อยู่รึเปล่า [ตอนที่ 1] ถ้าไม่มีก็ restart wifi ซะ</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%94%e0%b8%aa%e0%b8%ad%e0%b8%9a-servo-%e0%b8%9a%e0%b8%99-bash-shell-%e0%b9%83%e0%b8%99-raspberry-pi/" class="wp_rp_title">การทดสอบ servo บน bash shell ใน raspberry pi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%9b%e0%b8%a3%e0%b8%b1%e0%b8%9a%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2-dns-%e0%b8%9a%e0%b8%99-raspberry-pi-resolv/" class="wp_rp_title">การปรับตั้งค่า DNS ใน resolv.conf ไม่ให้โดนเขียนทับ บน RaspberryPi</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ad%e0%b9%88%e0%b8%b2%e0%b8%99-partition-ext23-%e0%b8%82%e0%b8%ad%e0%b8%87-raspberry-pi-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">วิธีการอ่าน Partition Ext2/3 ของ Raspberry Pi บน Mac OSX</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/nodejs-javascript-programming/auto-start-nodejs-when-boot-raspberry-pi/" class="wp_rp_title">วิธีการสั่งให้  forever / nodejs เปิดขึ้นมาทำงาน เมื่อ Raspberry Pi ทำงานครับ</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/linux/" title="linux">linux</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/piface/" title="piface">piface</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/python/" title="python">python</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberry-pi/" title="raspberry pi">raspberry pi</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/raspberrypi/" title="RaspberryPi">RaspberryPi</a><br />]]></content:encoded>
      </item>
      <item>
         <title>ทำระบบ monitor กากๆ เอาไว้เก็บข้อมูล cpu/ram/load เครื่อง mac ลง google spreadsheet</title>
         <link>http://www.together.in.th/programming-2/python-programming-2/%e0%b8%97%e0%b8%b3%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a-monitor-%e0%b8%81%e0%b8%b2%e0%b8%81%e0%b9%86-%e0%b9%80%e0%b8%ad%e0%b8%b2%e0%b9%84%e0%b8%a7%e0%b9%89%e0%b9%80%e0%b8%81%e0%b9%87%e0%b8%9a%e0%b8%82/</link>
         <description>สืบเนื่องมากจากการที่ผมพูดถึงการใช้ google spreadsheet  [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/blog/?p=4112</guid>
         <pubDate>Tue, 29 Jan 2013 16:46:59 +0000</pubDate>
         <content:encoded><![CDATA[<p>สืบเนื่องมากจากการที่ผมพูดถึงการใช้ <a rel="nofollow" target="_blank" href="http://www.together.in.th/blog/tag/google-spreadsheet/">google spreadsheet</a> เก็บข้อมูลในบล็อกไปหลายรอบ ยังมีอีกเรื่องนึงที่ผมยังไม่ได้บอกคือ จริงๆแล้วมันเกิดมาจากการที่ผมทำระบบ monitor เครื่อง mac mini ที่เป็น server อะไรซักอย่างนึงซึ่งทำงานแบบ graphic mode ต้อง teamviewer เข้าไปเพียงอย่างเดียว ซึ่งมันไม่สะดวกเลย<span id="more-4112"></span>จริงๆแล้วผมอยากได้แค่ข้อมูลสถานะของเครื่องเท่านั้นเอง ถ้าจะต้องลงโปรแกรมเพิ่มเติมก็หนักหนาพอสมควรอยู่(มันช้า) อีกเหตุหนึ่งที่สำคัญมากก็คือ เครื่องนี้มันทำงานอยู่ในระดับ production อยู่ด้วย. ทางออกของผมคือพยายามใช้ shells cript ส่งข้อมูลออกมา</p>
<p>ผมเลือกใช้คำสั่ง curl ให้ยิง post-request มาที่ server ส่วนที่รับผิดชอบเรื่องการเก็บข้อมูล ซึ่งผมใช้ <a rel="nofollow" target="_blank" href="http://flask.pocoo.org/">python flask</a> ส่วนแหล่งข้อมูลผมยกหน้าที่ให้คำสั่ง top (ใช้ เพราะว่ามีข้อมูลครบถ้วนตามที่ผมต้องการอยู่แล้ว (ผมอยากได้แค่ข้อมูลของ ram ที่เหลือ กับ cpu ที่ใช้)</p>
<p>หน้าตาของ shell script เลยเป็นแบบนี้ รีบทำมาก กากสุดๆ. (สั่ง top แม่มทุกรอบ) source code ใน shell script</p>
<p>ส่วน ใน python flask เขียนประมาณนี้ source code ใน flask</p>
<p><img alt="gdocs-data" src="https://lh5.googleusercontent.com/-bCqISt4cPNs/UQfwdrePQfI/AAAAAAAAHHI/pw0sAaWVaS8/s902/Screen+Shot+2556-01-29+at+10.50.32+PM.png"/> ภาพตัวอย่างอยู่ข้างบนจ้า</p>
<p>source code ทั้งหมดรอ blog รอบหน้านะครับ กำลังปรับปรุง :p</p>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/transform-google-docs-spreadsheet-into-json-or-jsonp/" class="wp_rp_title">วิธีการแปลงข้อมูลใน google spreadsheet ให้เป็น json</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/how-to-embed-google-document-preview/" class="wp_rp_title">แปะเอกสารจาก Google Docs เข้าใน Blog</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89-google-spreadsheet-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-database/" class="wp_rp_title">การใช้ google spreadsheet เป็น database</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/2012-06-16-write-blog-using-shellscript-coffeescript-and-applescript/" class="wp_rp_title">เขียนสคริปสำหรับเขียนบล็อก (และบล็อกบน github)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/google-2/%e0%b8%81%e0%b8%b9%e0%b9%80%e0%b8%81%e0%b8%b4%e0%b9%89%e0%b8%99-1-%e0%b9%81%e0%b8%a5%e0%b8%b0-%e0%b8%81%e0%b8%b9%e0%b9%80%e0%b8%81%e0%b8%b4%e0%b9%89%e0%b8%99%e0%b8%9e%e0%b8%a5%e0%b8%b1%e0%b8%aa/" class="wp_rp_title">กูเกิ้น +1 และ กูเกิ้นพลัส และ บล็อก</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/google-code-playground/" class="wp_rp_title">Google Code Playground</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/google-2/%e0%b8%81%e0%b8%b9%e0%b9%80%e0%b8%81%e0%b8%b4%e0%b9%89%e0%b8%99%e0%b8%aa%e0%b8%b0%e0%b8%95%e0%b8%ad%e0%b9%80%e0%b8%ab%e0%b8%a3%e0%b8%94-google-storage-store-your-data-in-googles-cloud/" class="wp_rp_title">กูเกิ้นสะตอเหรด (Google Storage) &#8212; Store your data in Google&#8217;s cloud </a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/%e0%b8%82%e0%b8%b2%e0%b8%a2%e0%b8%a7%e0%b8%b4%e0%b8%81wig-%e0%b8%9c%e0%b8%a1%e0%b8%a2%e0%b8%b2%e0%b8%a7-%e0%b8%aa%e0%b8%b5%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b9%81%e0%b8%94%e0%b8%87/" class="wp_rp_title">ขายวิก(wig) ผมยาว สีออกแดงนิดๆ จร้าา</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/letters-to-vanessa-on-love-science-and-awareness-in-an-enchanted-world/" class="wp_rp_title">จดหมายถึงวาเนสสา (หนังสือ) </a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/uncategorized/so-faraway/" class="wp_rp_title">So Faraway</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/flask/" title="flask">flask</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/google/" title="google">google</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/google-docs/" title="google docs">google docs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/google-spreadsheet/" title="google spreadsheet">google spreadsheet</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/python/" title="python">python</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/shell/" title="shell">shell</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/shell-script/" title="shell script">shell script</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/%e0%b8%81%e0%b8%b2%e0%b8%81/" title="&#x000e01;&#x000e32;&#x000e01;">กาก</a><br />]]></content:encoded>
      </item>
      <item>
         <title>การใช้ google spreadsheet เป็น database</title>
         <link>http://www.together.in.th/programming-2/python-programming-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89-google-spreadsheet-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-database/</link>
         <description>การใช้ google spreadsheet เป็น database ขี้เกียจพิมพ์เย [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/blog/?p=4109</guid>
         <pubDate>Sun, 20 Jan 2013 10:22:55 +0000</pubDate>
         <content:encoded><![CDATA[<p>การใช้ google spreadsheet เป็น database ขี้เกียจพิมพ์เยอะ ทนดู vdo เอาหน่อยละกันนะ</p>
<p></p> 
<p>จากตัวอย่างใน vdo เป็นการ backup ชื่อเพื่อนใน Facebook ลง google spreadsheet ซึ่ง code อยู่ข้างล่าง แต่เป็นเวอร์ชั่นที่ปรับปรุงจากใน vdo นิดหน่อย</p>
<p>จะมีเรื่องของ Thread/Race Condition เข้ามาเกี่ยวข้องนิดนึง ส่วน code มาแบบกากๆเลยจ้า<span id="more-4109"></span>code: <a rel="nofollow" target="_blank" href="https://gist.github.com/4577707">https://gist.github.com/4577707</a></p>
<p></p> 
<ul class="related_post wp_rp">ต่อด้วย
<li>
<h2><a rel="nofollow" class="wp_rp_title" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/%e0%b8%97%e0%b8%b3%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a-monitor-%e0%b8%81%e0%b8%b2%e0%b8%81%e0%b9%86-%e0%b9%80%e0%b8%ad%e0%b8%b2%e0%b9%84%e0%b8%a7%e0%b9%89%e0%b9%80%e0%b8%81%e0%b9%87%e0%b8%9a%e0%b8%82/">ทำระบบ monitor กากๆ เอาไว้เก็บข้อมูล cpu/ram/load เครื่อง mac ลง google spreadsheet</a></h2>
</li>
<li>
<h2><a rel="nofollow" target="_blank" href="https://docs.google.com/spreadsheets/d/1IP8rEhH4ktMK6tUShI4MqYJOwZXjnFrJwxDQVSJrLZg/edit#gid=9">https://docs.google.com/spreadsheets/d/1IP8rEhH4ktMK6tUShI4MqY</a></h2>
</li>
</ul>

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/%e0%b8%97%e0%b8%b3%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a-monitor-%e0%b8%81%e0%b8%b2%e0%b8%81%e0%b9%86-%e0%b9%80%e0%b8%ad%e0%b8%b2%e0%b9%84%e0%b8%a7%e0%b9%89%e0%b9%80%e0%b8%81%e0%b9%87%e0%b8%9a%e0%b8%82/" class="wp_rp_title">ทำระบบ monitor กากๆ เอาไว้เก็บข้อมูล cpu/ram/load เครื่อง mac ลง google spreadsheet</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/useful-facebook-comment-from-social-plugin/" class="wp_rp_title">ใช้ระบบ Comment ของ Facebook ให้เป็นประโยชน์</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/transform-google-docs-spreadsheet-into-json-or-jsonp/" class="wp_rp_title">วิธีการแปลงข้อมูลใน google spreadsheet ให้เป็น json</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/instal-django-%e0%b8%9a%e0%b8%99-mac-osx/" class="wp_rp_title">ติดตั้ง django บน  mac osx</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/%e0%b8%94%e0%b8%b2%e0%b8%a7%e0%b8%99%e0%b9%8c%e0%b9%82%e0%b8%ab%e0%b8%a5%e0%b8%94-youtube-vdo-%e0%b9%81%e0%b8%9a%e0%b8%9a-geek-%e0%b8%99%e0%b8%b4%e0%b8%94%e0%b9%86-python-youtube-dl/" class="wp_rp_title">[youtube-dl] ดาวน์โหลด youtube vdo แบบ geek (นิดๆ) &#8211;python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/python-programming-2/digital-image-processing-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">Digital Image Processing ด้วย Python (cs377)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/%e0%b8%aa%e0%b9%88%e0%b8%87-sms-%e0%b8%9a%e0%b8%99-raspberry-pi-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-python/" class="wp_rp_title">ส่ง SMS บน Raspberry Pi ด้วย python</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/browser/%e0%b8%aa%e0%b9%88%e0%b8%ad%e0%b8%87%e0%b8%aa%e0%b8%b2%e0%b8%a7%e0%b9%83%e0%b8%99-facebook-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-google-chrome-photo-zoom/" class="wp_rp_title">ส่องสาวใน Facebook ด้วย google Chrome Photo Zoom</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/social-networks/facebook/using-facebook-places-in-thailand/" class="wp_rp_title">วิธีการใช้งาน Facebook Places ในเมืองไทย (ก่อนใคร)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/embedded-system/raspberry-pi-2/piface-%e0%b8%a0%e0%b8%b2%e0%b8%84%e0%b8%95%e0%b8%b4%e0%b8%94%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87/" class="wp_rp_title">PiFace ภาคติดตั้ง</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/facebook-2/" title="facebook">facebook</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/facebook-api/" title="facebook api">facebook api</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/fbconsole/" title="fbconsole">fbconsole</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/gdata/" title="gdata">gdata</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/google-spreadsheet/" title="google spreadsheet">google spreadsheet</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/python/" title="python">python</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/race-condition/" title="race condition">race condition</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/semaphore/" title="semaphore">semaphore</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/thread/" title="thread">thread</a><br />]]></content:encoded>
      </item>
      <item>
         <title>เอา AngularJS มาทำโปรเจ็คขำๆบ้าง กรี๊ดเลย</title>
         <link>http://www.together.in.th/programming-2/javascript-programming-2/%e0%b9%80%e0%b8%ad%e0%b8%b2-angularjs-%e0%b8%a1%e0%b8%b2%e0%b8%97%e0%b8%b3%e0%b9%82%e0%b8%9b%e0%b8%a3%e0%b9%80%e0%b8%88%e0%b9%87%e0%b8%84%e0%b8%82%e0%b8%b3%e0%b9%86%e0%b8%9a%e0%b9%89%e0%b8%b2%e0%b8%87/</link>
         <description>คราวที่แล้ว เขียนบล็อกสั้นๆเรื่อง ลองหัดเขียน backbone. [&amp;#8230;]</description>
         <guid isPermaLink="false">http://www.together.in.th/blog/?p=4104</guid>
         <pubDate>Sun, 20 Jan 2013 10:03:15 +0000</pubDate>
         <content:encoded><![CDATA[<p>คราวที่แล้ว เขียนบล็อกสั้นๆเรื่อง <a rel="nofollow" target="_blank" href="http://fb.me/1PBarunkD">ลองหัดเขียน backbone.js กับโปรเจ็คเล็กๆ ขำๆ</a> ซึ่งเป็นโปรเจ็คที่เอาไว้ดูกล้อง CCTV ทั่วกรุงเทพ ไปแล้ววันนี้มาลองทำด้วย angularjs กันบ้าง ไหนๆก็ทำฝั่ง server ไปบ้างแล้ว ซึ่งข้อมูลก็มาจาก Traffy แต่ว่ามาผ่าน Drupal7 Module: <a rel="nofollow" target="_blank" href="http://www.together.in.th/blog/traffy-api-wrapper-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-drupal7/">TraffyAPI Wrapper</a> ก่อนทีนึงก่อน แล้วมาตัดแต่งพันธุกรรมของ json ที่ Flask ดูได้ที่ไฟล์ <a rel="nofollow" target="_blank" href="https://github.com/NAzT/bangkok-cctv-backbonejs/blob/master/app.py">app.py</a> </p>
<p>ลองเล่นได้<a rel="nofollow" target="_blank" href="http://bangkok-cctv.herokuapp.com/static/angularjs/index.html">ที่นี่</a>จ้า</p>
<p>พอทำแล้วพบว่ากรี๊ดเลย ขนาดเคยเขียนมาบ้างแล้วนะ ลองมาดู code กัน มันมีแค่นี้เอง</p>
<p><span id="more-4104"></span>gist: <a rel="nofollow" target="_blank" href="https://gist.github.com/4577599">https://gist.github.com/4577599</a></p>
<p></p> 

<div class="wp_rp_wrap  wp_rp_plain"><div class="wp_rp_content"><h3 class="related_post_title">เรื่องที่เกี่ยวข้อง</h3><ul class="related_post wp_rp"><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/see-all-cctv-camera-bangkok-traffy-wrapper-api-jquery-json/" class="wp_rp_title">ดูกล้อง CCTV ทั่วกรุงเทพ ด้วย Traffy API [Wrapper/Proxy] + jQuery + JSONP</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/php-programming-2/traffy-api-wrapper-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-drupal7/" class="wp_rp_title">Traffy API Wrapper ด้วย  Drupal7</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/drupal-2/view-cctv-camera-using-traffy-api-and-drupal7/" class="wp_rp_title">ดูภาพจากกล้อง CCTV ทั่วกรุงเทพ ด้วย  TraffyAPI (และ Drupal7)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/json-programming-2/track-bangkok-vms-using-traffy-api-wrapper/" class="wp_rp_title">มาดูป้ายจราจรอัจฉริยะทั่วกรุงเทพและลองใช้ API ดึงข้อมูลกันดีกว่า</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/mock-domain-model-%e0%b9%83%e0%b8%99-angularjs/" class="wp_rp_title">วิธีการ Mock Domain Model ใน AngularJS</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/realtime-lyric-itunes-nodejs-applescript-socket-io-angularjs/" class="wp_rp_title">ดูเนื้อเพลงที่กำลังเล่นใน itunes แบบ realtime</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-hangman-%e0%b8%94%e0%b9%89%e0%b8%a7%e0%b8%a2-angularjs-tdd/" class="wp_rp_title">เขียน Hangman ด้วย AngularJS ( TDD )</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/drupal-2/cache-for-traffy-api-proxywrapper-drupal7/" class="wp_rp_title">ทำ cache ให้ Traffy API [Proxy/Wrapper] แล้วจ้า (Drupal7)</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/javascript-programming-2/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%97%e0%b8%b3-unit-test-%e0%b9%83%e0%b8%99%e0%b8%aa%e0%b9%88%e0%b8%a7%e0%b8%99%e0%b8%82%e0%b8%ad%e0%b8%87-service-%e0%b8%82%e0%b8%ad%e0%b8%87-angularjs/" class="wp_rp_title">การทำ unit test ในส่วนของ service ของ angularjs</a></li><li><a rel="nofollow" target="_blank" href="http://www.together.in.th/programming-2/drupal-2/drupal6-%e0%b9%83%e0%b8%8a%e0%b9%89-views-%e0%b8%94%e0%b8%b6%e0%b8%87%e0%b8%a0%e0%b8%b2%e0%b8%9e%e0%b8%88%e0%b8%b2%e0%b8%81-forum-topic-%e0%b8%ad%e0%b8%ad%e0%b8%81%e0%b8%a1%e0%b8%b2/" class="wp_rp_title">[drupal6] ใช้ Views ดึงภาพจาก Forum Topic ออกมา</a></li></ul></div></div>

	Tag: <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/angularjs/" title="angularjs">angularjs</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/bangkok-cctv/" title="bangkok cctv">bangkok cctv</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/cctv/" title="cctv">cctv</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/drupal/" title="drupal">drupal</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/javascript/" title="javascript">javascript</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/traffy/" title="traffy">traffy</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/traffy-api/" title="traffy api">traffy api</a>, <a rel="nofollow" target="_blank" href="http://www.together.in.th/tag/traffy-api-wrapper/" title="traffy api wrapper">traffy api wrapper</a><br />]]></content:encoded>
      </item>
   </channel>
</rss>
<!-- fe8.yql.bf1.yahoo.com compressed/chunked Thu Oct  1 23:25:06 UTC 2015 -->
