M♪o 之學習筆記本《子》開關︰【紅火禮】謙和有禮

派生碼訊

子 鼠

天澤履 ䷉ ,素履之往,獨行愿也。幽人貞吉,中不自亂也。愬愬終吉,志行也。視履考祥,其旋元吉。

紅火禮︰《説文解字》:禮,履也。所以事神致福也。从示从豊,豊亦聲。 古禮 ,古文禮。程式之先,當思其 禮 禮,當作說明,以利分享,以及來日之自讀。

 

派 ︰《了凡四訓》有言︰

何謂真假?昔有儒生數輩,謁中峰和尚,

問曰︰「佛氏論善惡報應,如影隨 形。今某人善,而子孫不興;某人惡,而家門隆盛︰佛說無稽矣。」

中峰云︰「凡情未滌,正眼未開,認善為惡,指惡為善,往往有之 。不憾己之是非顛倒,而反怨 天之報應有差乎?」

眾曰︰「善惡何致相反?」

中峰令試言。

一人謂「詈人毆人是惡;敬人禮人是善。」

中峰云︰「未必然也。」

一人謂「貪財妄取是惡,廉潔有守是善。」

中峰云︰「未必然也。」

眾人歷言其狀,中峰皆謂不然。因請問。

中峰告之曰︰「有益於人,是善;有益於己,是惡。有益於人,則毆人,詈人皆善也;有益於己,則敬人,禮人皆惡也。 是故人之行善,利人者公,公則為真;利己者私,私則為假。又根心者真,襲跡者假;又無為而為者真,有為而為者假;皆當自考。」

何謂端曲?今人見謹愿之士,,類稱為善而取之;聖人則寧取狂狷。至於謹愿之士,雖一鄉皆好,而必以為德之賊;是世人之善惡,分明與聖人相反。推此一端,種種取舍,無有不謬;天地鬼神之福善禍淫,皆與聖人同是非,而不與世俗同取舍。凡欲積善,決不可徇耳目,惟從心源隱微處,默默洗滌,純是濟世之心,則為端;苟有一毫媚世之心,即為曲;純 是愛人之心,則為端;有一毫憤世之心,即為曲;純是敬人之心,則為端;有一毫玩世之心,即為曲;皆當細辨。

……

 

生 昔有『唐鳳』者,能文善語『珍珠串』☿☺︰

=head1 NAME
Lingua::Sinica::PerlYuYan – 中書珨 – Perl in Classical Chinese in Perl
=head1 VERSION
our VERSION = 1257700140.47574; # 2009年11月 9日 周一 01時09分11秒 CST</span>  <span style="color: #808000;">=head1 SYNOPSIS</span> <span style="color: #808000;"> # The Sieve of Eratosthenes - 埃拉托斯芬篩法</span> <span style="color: #808000;"> use Lingua::Sinica::PerlYuYan;</span>  <span style="color: #808000;">用籌兮用嚴。井涸兮無礙</span> <span style="color: #808000;"> 。印曰最高矣 又道數然哉。</span> <span style="color: #808000;"> 。截起吾純風 賦小入大合。</span> <span style="color: #808000;"> 。習予吾陣地 並二至純風。</span> <span style="color: #808000;"> 。當起段賦取 加陣地合始。</span> <span style="color: #808000;"> 。陣地賦篩始 繫繫此雜段。</span> <span style="color: #808000;"> 。終陣地兮印 正道次標哉。</span> <span style="color: #808000;"> 。輸空接段點 列終註泰來。</span>  <span style="color: #808000;">=head1 DESCRIPTION</span> <span style="color: #808000;"> This module makes it possible to write Perl programs in Classical Chinese poetry in Perl.</span>  <span style="color: #808000;">說此經者,能以珨文言文珨。</span>  <span style="color: #808000;">(If one I<has> to ask "Why?", please refer to L<Lingua::Romana::Perligata> for</span> <span style="color: #808000;"> related information.)</span>  。昔事已隨黃鶴去,此時空餘黃鶴樓。『珨』本無言語?!  <span style="color: #808080;">《廣韻》侯夾切《集韻》轄夾切,音洽。《玉篇》玉蛤,一云蜃器 。《集韻》蜃飾器。</span> <span style="color: #808080;"> 又《五音集韻》烏甲切,音鴨。開閉門也。</span>  此『經』將訴誰人知??又有『<a href="http://zh.wikipedia.org/zh-tw/%E5%91%A8%E8%9F%92">周蟒</a>』者,自稱『<a href="http://blog.gasolin.idv.tw/2007/09/blog-post_22.html">蓋索林</a>』 Gasolin ,曾把『派生』中文化,獨立<a href="http://code.google.com/p/zhpy/wiki/CodingStyle">風格</a>與<a href="http://blog.gasolin.idv.tw/2007/09/blog-post_22.html">堅持</a>,條條大道通羅馬。不知何因<a href="http://code.google.com/p/zhpy/">棄城池</a>,古道西風存瘦馬 ☿☹!剪不斷,理還亂,符碼文化聲聲慢,ㄚ˙禮多人不怪,斷腸人在天之涯!!     ☆ 編者言<a href="http://www.freesandal.org/wp-content/uploads/%E8%AA%AA%E6%98%8E.gif"><img class="alignnone size-full wp-image-32950" src="http://www.freesandal.org/wp-content/uploads/%E8%AA%AA%E6%98%8E.gif" alt="說明" width="120" height="19" /></a>  讀者需知『轉譯』之不易,此處 M♪o 用其家鄉之『<a href="http://www.freesandal.org/?m=20150319">城南舊事</a>』,將如何比擬恰當,或該寫『<a href="http://www.freesandal.org/?p=7613">圖靈</a>』,只恐不符旨意,或應說『<a href="http://zh.wikipedia.org/zh-tw/%E5%90%B3%E9%B3%B3">吳鳳</a>』 ,大概沒這事理,無法之法,採用莊子『隨寫隨掃』之筆法,以為『辜妄言之』哉!!     △   <strong><a href="https://www.python.org/dev/peps/pep-0257/">PEP 0257 -- Docstring Conventions</a></strong> <div id="abstract" class="section"> <h1><a class="toc-backref" href="https://www.python.org/dev/peps/pep-0257/#id12"> Abstract </a></h1> This PEP documents the semantics and conventions associated with Python docstrings.  </div> <div id="rationale" class="section"> <h1><a class="toc-backref" href="https://www.python.org/dev/peps/pep-0257/#id13"> Rationale </a></h1> The aim of this PEP is to standardize the high-level structure of docstrings: what they should contain, and how to say it (without touching on any markup syntax within docstrings). The PEP contains conventions, not laws or syntax. <blockquote>"A universal convention supplies all of maintainability, clarity, consistency, and a foundation for good programming habits too. What it doesn't do is insist that you follow it against your will. That's Python!" —Tim Peters on comp.lang.python, 2001-06-16 </blockquote> If you violate these conventions, the worst you'll get is some dirty looks. But some software (such as the <a class="reference external" href="http://docutils.sourceforge.net/"> Docutils </a> <a id="id7" class="footnote-reference" href="https://www.python.org/dev/peps/pep-0257/#id6"> [3] </a> docstring processing system <a id="id1" class="footnote-reference" href="https://www.python.org/dev/peps/pep-0257/#id4"> [1] </a> <a id="id2" class="footnote-reference" href="https://www.python.org/dev/peps/pep-0257/#id5"> [2] </a> ) will be aware of the conventions, so following them will get you the best results.  </div> …  △ 文件 ``〒'' 程式 ☿ ??  文字之先,巨鵝踏天;程式之前,哪來文件 ☿ !!     <a href="http://www.freesandal.org/wp-content/uploads/%E7%A2%BC1.png"><img class="alignnone size-full wp-image-32798" src="http://www.freesandal.org/wp-content/uploads/%E7%A2%BC1.png" alt="碼" width="48" height="48" /></a> <span style="color: #c0c0c0;"><strong>碼</strong></span>︰有 <a href="http://www.freesandal.org/wp-content/uploads/%E7%BF%92.gif"><img class="alignnone size-full wp-image-32959" src="http://www.freesandal.org/wp-content/uploads/%E7%BF%92.gif" alt="習" width="24" height="44" /></a> <strong>習</strong>。試以互動程式申論『樹莓派』板子編號制,第二十三根『入浮針』【※ input float pin 】的讀取情狀?  ☿ <a href="http://www.freesandal.org/wp-content/uploads/%E8%A1%8C.gif"><img class="alignnone size-full wp-image-32960" src="http://www.freesandal.org/wp-content/uploads/%E8%A1%8C.gif" alt="行" width="36" height="41" /></a> <strong>答</strong>︰一《圖》  <a href="http://www.freesandal.org/wp-content/uploads/debouce-graph.png"><img class="alignnone size-medium wp-image-32955" src="http://www.freesandal.org/wp-content/uploads/debouce-graph-300x190.png" alt="debouce-graph" width="300" height="190" /></a>  可抵千百字,入浮特性看分明,查考  《 <strong><a href="http://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/">raspberry-gpio-python</a></strong> 》文件,說的詳細︰ <h1 id="inputs">Inputs</h1> There are several ways of getting GPIO input into your program. The first and simplest way is to check the input value at a point in time. This is known as 'polling' and can potentially miss an input if your program reads the value at the wrong time. Polling is performed in loops and can potentially be processor intensive. The other way of responding to a GPIO input is using 'interrupts' (edge detection). An edge is the name of a transition from HIGH to LOW (falling edge) or LOW to HIGH (rising edge). <h2 id="pull-up-pull-down-resistors">Pull up / Pull down resistors</h2> If you do not have the input pin connected to anything, it will 'float'. In other words, the value that is read in is undefined because it is not connected to anything until you press a button or switch. It will probably change value a lot as a result of receiving mains interference.  To get round this, we use a pull up or a pull down resistor. In this way, the default value of the input can be set. It is possible to have pull up/down resistors in hardware and using software. In hardware, a 10K resistor between the input channel and 3.3V (pull-up) or 0V (pull-down) is commonly used. The RPi.GPIO module allows you to configure the Broadcom SOC to do this in software:  <span style="color: #808080;">GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)</span> <span style="color: #808080;"> # or</span> <span style="color: #808080;"> GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)</span>  (where channel is the channel number based on the numbering system you have specified - BOARD or BCM).     實測驗證現情狀︰ <pre class="lang:sh decode:true"># 超級者 sudoer 方可以出入無礙 pi@raspberrypi ~ sudo -s
root@raspberrypi:/home/pi#

# 採用『派生』三
root@raspberrypi:/home/pi# python3
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

# 載入 GPIO 程式庫
>>> import RPi.GPIO as GPIO

# 載入 time 程式庫
>>> import time

# 選擇板子編號制
>>> GPIO.setmode(GPIO.BOARD)

# 指定入浮針
>>> 入浮針 = 23
>>> GPIO.setup(入浮針, GPIO.IN)

# 隨機測試讀取值
>>> GPIO.input(入浮針)
0
>>> GPIO.input(入浮針)
0
>>> GPIO.input(入浮針)
0
>>> GPIO.input(入浮針)
0

# 驗證入浮一般讀取為『低』 0 態
>>> 計次 = 1
>>> while GPIO.input(入浮針) == GPIO.LOW and 計次 < 10000 :
… time.sleep(0.01)
… 計次 += 1

# 確認萬中無一次
>>> print(計次)
10000

# 查核『上拉』 pull_up 『下拉』 pull_down 皆無誤
>>> GPIO.setup(入浮針, GPIO.IN,pull_up_down = GPIO.PUD_UP)
>>> GPIO.input(入浮針)
1
>>> GPIO.setup(入浮針, GPIO.IN,pull_up_down = GPIO.PUD_DOWN)
>>> GPIO.input(入浮針)
0
>>>
>>>

 

訊 非詩;扉思

謙山在地中
和樂湧心頭
有陽當空照
禮運似水流

 

 

 

 

 

M♪o 之學習筆記本《子》開關︰【青木仁】格物致知

派生碼訊

子 鼠

大學之道,
在明明德,
在親民,
在止於至善。

青木仁︰ 揚雄《太玄經》《玄首》︰好是已定,疑非而或之,好惡著焉,所謂格物取此。

實乃三進制之祖,欲窮 天地人 天地人之道,所謂 格各 各者,即是今之實驗者也。開、關者二,其未定者有一,故為三態。

 

派Einstein 1933

Pure logical thinking cannot yield us any knowledge of the empirical world; all knowledge starts from experience and ends in it. Propositions arrived at by purely logical means are completely empty as regards reality.

 

生 ︰格物何事也?

格竹子之說︰

王陽明全書‧卷三‧傳習錄下

黃以方問:「『博學於文』為隨事學存此天理,然則謂『行有餘力 ,則以學文』,其說似不相合。」先生曰:「《詩》、《書》、六藝皆是天理之發見,文字都包在其中。考之《詩》、《書》、六藝 ,皆所以學存此天理也,不特發見於事為者方為文耳。餘力學文,亦只博學於文中事。」

或問「學而不思」二句。曰:「此亦有為而言,其實思即學也。學有所疑,便須思之。思而不學者,蓋有此等人,只懸空去思,要想出一個道理,卻不在身心上實用其力以學存此天理,思與學作兩事做,故有罔與殆之病。其實思只是思其所學,原非兩事也。」

先生曰:「先儒解格物為格天下之物,天下之物如何格得?且謂一草一木亦皆有理,今如何去格?縱格得草木來,如何反來誠得自家意?我解『格』作『正』字義, 『物』作『事』字義。《大學》之所謂身,即耳目口鼻四肢是也。欲修身,便是要目非禮勿視,耳非禮勿聽,口非禮勿言,四肢非禮勿動。要修這個身,身上如何用得工夫?心者身之主宰,目雖視而所以視者心也,耳雖聽而所以聽者心也,口與四肢雖言動而所以言動者心也。故欲修身,在於體當自家心體,當令廓然大公,無有些子不正處。主宰一正,則發竅於目 ,自無非禮之視;發竅於耳,自無非禮之聽;發竅於口與四肢,自無非禮之言動。此便是修身在正其心。然至善者,心之本體 也。心之本體,那有不善?如今要正心,本體上何處用得功?必就心之發動處才可著力也。心之發動不能無不善,故須就此處著力,便是在誠意。如一念發在好善上,便實實落落去好善;一念發在惡惡上,便實實落落去惡惡。意之所發既無不誠,則其本體如何有不正的?故欲正其心在誠意。工夫到誠意,始有著落處。然誠意之本,又在於致知也。所謂人雖不知而已所獨知者,此正是吾心良知處。然知得善,卻不依這個良知便做去,知得不善,卻不依這個良知便不去做,則這個良知便遮蔽了,是不能致知也。吾心良知既不能擴充到底,則善雖知好,不能著實好了;惡雖知惡,不能著實惡了,如何得意誠?故致知者,意誠之本也。然亦不是懸空的致知,致知在實事上格。如意在於為善,便就這件事上去為;意在於去惡,便就這件事上去不為。去惡固是格不正以歸於正,為善則不善正了,亦是格不正以歸於正也。如此,則吾心良知無私慾蔽了,得以致其極,而意之所發,好善去惡,無有不誠矣。誠意工夫實下手處,在格物也。若如此格物,人人便做得,『人皆可以為堯 舜』,正在此也。 」

先生曰:「眾人只說格物要依晦翁,何曾把他的說去用?我著實曾用來。初年與錢友同論做聖賢,要格天下之物,如今安得這等大的力量?因指亭前竹子,令去格看。錢子早夜去窮格竹子的道理,竭其心思,至於三日,便致勞神成疾。當初說他這是精力不足,某因自去窮格,早夜不得其理, 到七日,亦以勞思致疾。遂相與歎聖賢是做不得的,無他大力量去格物了。及在夷中三年,頗見得此意思 ,乃知天下之物本無可格者,其格物之功,只在身心上做。 決然以聖人為人人可到,便自有擔當了。這裡意思,卻要說與諸公知道。 」

……

 

△ 『格』『物』得知『物』之『理』。

△ 用『物』之『理』推導『物』之『行』。

天命之謂性通天
運命在人行法地
天地命運者無言
運命天地者常噫

 

碼 ︰無 習 。只是一《圖》︰

simple-circuit

格《圖》耶?燈不開不亮,若開,缺限流電阻,恐燈毀也。此電阻之大小,須就 LED 規格給之。☿☹ 詐氐 ㄓㄚˇ ㄉ一˙ 【※是怎樣之意】,總不給實習!

行 ︰《小狐狸》之書曾寫過︰

就讓我們透過『 Sysfs 』── 是 Linux 2.6 所提供的一種『虛擬檔案系統』 VFS virtual files system 。這個檔案系統不僅可以把『裝置』 devices 和『驅動程式』 device drivers 的資訊從『核心』 kernel 內部輸出到『使用者空間』 user space ,也可以用來對裝置和驅動程式做『設定』。── 來控制『系統 ACT LED』,與 GPIO建立聯繫』吧!

# 為什麼一定得是 root 呢?可以只用 sudo 嗎??
sudo -s

echo none > /sys/class/leds/led0/trigger
echo 1 >/sys/class/leds/led0/brightness
echo 0 >/sys/class/leds/led0/brightness
echo 1 >/sys/class/leds/led0/brightness
echo 0 >/sys/class/leds/led0/brightness
exit

 

Ah Ha!!這樣想要有顆『閃爍』的『小星星』,怕是不可得的了,何不閱讀《 Advanced Bash-Scripting Guide 》一下,寫個『 Shell 』程式呢??

。雖說曾聞『早鳥氏』實證時否定了,然『盡信書,不如無書』,況此一時彼一時已經不同,何不自己格之!!

root@raspberrypi:/sys/class/gpio# cd /sys/class/leds/
root@raspberrypi:/sys/class/leds# ls
led0  led1
root@raspberrypi:/sys/class/leds# cd led0
root@raspberrypi:/sys/class/leds/led0# ls
brightness  device  max_brightness  subsystem  trigger	uevent
echo none > /sys/class/leds/led0/trigger
root@raspberrypi:/sys/class/leds/led0# echo 1 >/sys/class/leds/led0/brightness
root@raspberrypi:/sys/class/leds/led0# echo 0 >/sys/class/leds/led0/brightness
root@raspberrypi:/sys/class/leds/led0# 

果然大功告成。噫!怎有個『 led1 』哩?何妨依樣畫葫蘆!… ☿☺

☆ 編者言說明

此處『…』並非編者刻意不譯,實在是 M♪o 沒寫,從她的笑臉推斷 , M♪o 似了然於心的了,讀者何不自己嘗試嘗試的呢??

 

訊 ︰☿☺ 天下無難事,只怕有心人。

 

 

 

 

M♪o 之學習筆記本《子》開關︰【黑水智】數位之源

派生碼訊

子 鼠

王之渙‧登鸛雀樓

白日依山盡,黃河入海流;
欲窮千里目,更上一層樓。

黑水智︰ 天地如風箱,開關司啟閉,陰 ䷁ 陽 ䷀ 之情見矣。伏羲氏之大易理則,孤虛者的邏輯宇宙,布林代數邏輯電路的數位設計之國度。

 

派未知何年何月,有一

孤虛者言︰

物有無者,非真假也。苟日新,日日新,又日新。真假者,物之論也。論也者,當或不當而已矣。故世有孤虛者,言有孤虛論。孤虛何謂也?甲乙孤虛,言不得全真也,索其孤其虛而已矣。天地孤虛 ,去其上下也,善惡孤虛,何得善惡並真乎?是故孤虛論全矣!

其法曰︰物物孤虛,言物之非也;孤虛之孤虛,此孤虛 之非也。使甲與乙並,此甲乙辜虛之非也,強使之或,乃非甲非乙之孤虛也。若云由此及彼,雖言之鑿鑿,若非彼與此之孤虛,无能以斷疑是也 !!

假使依據孤虛 ── Sheffer 豎線 ──所說則︰

P\sim P = P \mid P

PQP \cdot Q = P \wedge Q = (P \mid Q) \mid (P \mid Q)

PQP + Q = P \vee Q = (P \mid P) \mid (Q \mid Q)

PQP \rightarrow Q =  P  \mid (Q \mid Q)

 

生 開關何物也?

開關是指一個可以使電路開路、使電流中斷或使其流到其他電路的電子元件。最常見的開關是讓人操作機器裝置或下達命令的操作開關,其中有一個或數個電子接點。接點的「閉合」(closed)表示電子接點導通,允許電流流過;開關的「開路」(open)表示電子接點不導通形成開路,不允許電流流過。

Switch

Since the advent of digital logic in the 1950s, the term switch has spread to a variety of digital active devices such as transistors and logic gates whose function is to change their output state between two logic levels or connect different signal lines, and even computers, network switches, whose function is to provide connections between different ports in a computer network.[15] The term ‘switched’ is also applied to telecommunications networks, and signifies a network that is circuit switched, providing dedicated circuits for communication between end nodes, such as the public switched telephone network. The common feature of all these usages is they refer to devices that control a binary state: they are either on or off, closed or open, connected or not connected.

△ 《圖》圖曰︰

彈跳之事需細究,開關物理說分明,簡諧振子道其詳。

【示波器截圖】

200px-Bouncy_Switch

若問軟體將如何?一圖能說省千言。

debouce-graph

 

碼 ︰無 習 。☹

行 ︰雖無金剛鑽,敢作瓷器活。☺,所謂『可出入』者,可『出』即可『入』,何不測試這果真耶?

針太極』  ☿☺ Pin 出入者之電路特性︰

raspberry-pi-circuit-gpio-input-pins

查考《咸澤碼訊》之『針 圖 』︰

a-and-b-physical-pin-numbers

Raspberry-Pi-GPIO-Layout-Revision-2

就選第二十四針, GPIO 8 的吧!

☆ 編者言說明

想 M♪o 應是『上網』查詢,特此擬之以樹莓派網路『針腳』網頁︰

pinout-logo Raspberry Pinout

BCM 8 (SPI Chip Select 0)

Alt0 Alt1 Alt2 Alt3 Alt4 Alt5
SPI0_CE0_N SD0 Reserved
  • Physical pin 24
  • BCM pin 8
  • Wiring Pi pin 10

再閱讀《庫文》【※蓋指程式庫文件】,寫此︰

# 超級者 sudoer 方可以出入無礙
pi@raspberrypi ~ $ sudo -s
root@raspberrypi:/home/pi# python3
Python 3.2.3 (default, Mar  1 2013, 11:53:50) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

# 載入程式庫
>>> import RPi.GPIO as GPIO

# 使用板子循序編號
>>> GPIO.setmode(GPIO.BOARD)

# 指定出入針
>>> 出針 = 24
>>> 入針 = 24

# 將之設定為『出』針
>>> GPIO.setup(出針, GPIO.OUT)

# 針出『高』勢
>>> GPIO.output(出針, GPIO.HIGH)

# 果真?
>>> GPIO.input(入針)
1

# 針出『低』勢
>>> GPIO.output(出針, GPIO.LOW)

# 當然?
>>> GPIO.input(入針)
0
>>> 

☿☺ , Ah Ha !!

 

訊 ︰☿☹☺ 當真得『大膽假設,小心求證』的哩。

 

 

 

 

 

M♪o 之學習筆記本《子》開關

派生碼訊

子 鼠

蕩蕩天門萬古開,
幾人歸去幾人來。
山河雖好非完璧,
不信黃金是禍胎。

子鼠︰ 兩態系統是數位設計之本。數學完整的編碼體系布林代數為集其大成者也。

雖然已經說明編輯體例,不略說說改寫規則,恐怕失真。這 M♪o 她學習的孜孜不倦,閱讀之熱情不息,讓作者苦惱。由於我們與她們之間的『社會』不同與『科技』有異,所以有時不得不以『人類』之角度來引用『術語』和『名物』,萬一有所『誤解』,絕非 M♪o 之『過』,實是改寫者之『錯讀』所造成的,特此聲明。舉例而言 ,『踏天之紀』改為『伏羲之時』等等,若加上『註釋』未免閱讀不易,又恐讓作者自曝其短,所以不出『校記』,希望讀者知之。再者該筆記篇幅巨大,因此只擇部分『譯改』,萬一有前後不搭,尚祈見諒。

 

派︰伏羲之時,已知太極陰陽,然而太極之非陰非陽與或陰或陽之陰陽不測的古意雖喪,大道源流依據不失。現今正負之理,始於『卡文迪什』親身體驗 ☿☹︰

鐵線』的電傳導性要比『蒸餾水』好上四億倍,『海水』又比『雨水』好一百倍,然而『飽和』的『海鹽溶液』要比『雨水』更好了七百二十倍……

;其後『歐姆』歸結為『因勢 VIR』 ☿☺︰

V = I \times R

。之後又有了『焦耳』的『熱功當量』︰

他將一段導線浸入定量的水中,然後量測上升的溫度,在實驗過各種材質的導體、多種電流大小與不同時間長短後發現

Q = I^2 \cdot R \cdot t

,此處 Q 是熱量【焦耳】、 I 是電流量【安培】、 R 是電阻值【歐姆】、 t 時間【秒】。

故說『熱焦』 ☿☺ 電路者常是瞬間『勢利』 V \times I 過大太久所致。

※註︰  ☿☹ 以及 ☿☺ 是 M♪o 筆記裡的特有符號,雖說推想是表達 M♪o 的『心情』,就其使用脈落而言,彷彿更像是種『聯想法』。

 

生 ︰『針太極』  ☿☺ Pin 出入者之電路特性︰

raspberry-pi-circuit-gpio-input-pins

 

☆ 編者言說明

因選擇了『樹莓派』作為『實習』的計算機主體,故 M♪o 筆記裡的一切有關資料『改編』以『樹莓派』基金會官方的『說明』為主,不足時,補以其它來源。比方說,此『輸出入』『針』腳, M♪o 記之以『太極』者,蓋因為既可用作『輸出』,又可用於『輸入』。而且當作『輸入』時,若是不設定『 Pull-up 』或『 Pull-down 』,如《 An introduction to GPIO and physical computing on the Raspberry Pi 》所講︰

Input

GPIO outputs are easy; they are on or off, HIGH or LOW, 3v3 or 0v. Inputs are a bit trickier because of the way that digital devices work. Although it might seem reasonable just to connect a button across an input pin and a ground pin, the Pi can get confused as to whether the button is on or off. It might work properly, it might not. It’s a bit like floating about in deep space; without a reference it would be hard to tell if you were going up or down, or even what up or down meant!

This is why you will see phrases like “pull up” and “pull down” in Raspberry Pi GPIO tutorials. It’s a way of giving the input pin a reference so it knows for certain when an input is received.

If you’d like to have a go at using the GPIO as an input then have a look at our screaming jelly baby and quick reaction game tutorials for Python, or a reaction game for Scratch.

,果有類似 M♪o 所用之『物』的特性。雖想自然之理是一脈相通,有時確有偏勝之處,特以『☆ 編者言說明』符號表明此係編者之言,對錯真假與 M♪o 無涉。

△ 電工之行, 安 安特第一。【※ Tux 語言,專有詞法,請參考 Tux@rpi ︰《踏天之梯》,未免於失實失義,用古今字轉譯,存其會意。此處『安特』意指︰安全性重要的不得了!!】

△ 電路之設,在『內』『外』之『阻導』之配,《 圖 》圖曰︰

EGHS-PullUpDownSwitchProtected

,須細究其理。

☆ 編者言說明

由於不知那《圖》是何書?也許是 TUX 的教科書吧!還好 M♪o 她喜歡自己手繪,編者方得『按圖索驥』,求可匹配的『電路圖』,此後文章,凡用《 圖 》符示者,皆同此意。這裡的這張圖,出自《 Physical computing with Raspberry Pi 》︰

BACKGROUND:

Circuit with current-limiting resistors in place. Diagram from eLinux.

When a GPIO pin is set as an input it is “floating” and has no defined voltage level. For us to be able to reliably detect whether the input is high or low we need to tie it so that it is always connected and either reads high or low.

To tie the pin we connect either a Pull Up or Pull Down resistor. A Pull down resistor connects the pin to ground through a large resistor, this means that when the switch is open there is a path to ground and so it will read low. When the switch is pressed (with the other side connected to 3.3V) there is a lower resistance path to high and so the pin will read high. The large (10kΩ) resistor ensures that only a little current is drawn when the switch is pressed.

Setting up a circuit like this means that we will be able to take reliable readings from a switch, however we could still damage the pins if they are accidentally set to an output. If we drive it low the output is connected directly to ground. Pushing the button will then create a short circuit between 3.3V and ground! To make this safer we put in a current limiting resistor (1kΩ will do) to make sure the Pi can handle the current drawn.

,因為意義相通而選擇。

 

碼 ︰無 習 。【※蓋指沒有習作】

行 ︰……

☆ 編者言說明

此處『…』者並非『留白』不譯,因為那是 M♪o 自己的先行練習,轉譯需要一個『軟體環境』,於此假設我們主要使用︰

‧ Python3

‧ python-rpi.gpio

‧ wiringPi

‧ ……

在此選擇 Python3 的原因,是因為如

W!o 的派生‧十日談之《六》 一文上所講︰

然而從 Python 3.0 開始,『派生』已經支持『萬國碼』 Unicode 的『標識符』,這意味著︰

# 可以使用中文『標識符』
>>> 甲=7
>>> 乙=甲*甲-3*甲+2
>>> 甲;乙
7
30
>>>

。這使得翻譯『軟體習作』更貼近 M♪o 的精神。同時假設讀者使用的是已經中文化了的官方版 Raspbian 發行版。

如是那段文字,可以轉譯成︰安裝設定軟體『習作環境』。

# 更新至最新版
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

# 安裝 Python 開發環境與套件工具
sudo apt-get install python2.7-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo apt-get install python3-pip

# 應該已是預設安裝
sudo apt-get install git-core
sudo apt-get install python-rpi.gpio

# 安裝 wiringPi
git clone git://git.drogon.net/wiringPi
cd wiringPi/
./build

# 安裝 wiringPi Python 套件
sudo pip install wiringpi2
sudo pip-3.2 install wiringpi2
#

過去作者曾經寫過相關若干套《系列文章》,讀者也可瀏覽,選讀有興趣的部分,此處僅列出每套的首篇,以利檢索︰

Physical computing ︰《一》引言

春雷早發︰樹莓派 2 Model B ︰早鳥篇

大樹底下好乘涼 ︰ 《開場白》

‧  W!o 的派生‧十日談之《一》

《派生》 Python 作坊【甲】尋本溯源

 

訊 ︰需要自修『電路學』知識,才能充分理解『電路工作』原理。 ☿☹☺ 千里之行,始於足下。

 

 

 

 

 

M♪o 之學習筆記本《編者按》

子虛之事,烏有之物,何處得來?為著釋疑,作者不得不特寫這本『 M♪o 之學習筆記本』的由來。雖然有所本,講來自己卻也難信,實在說來自那離群的西伯利亞『小雪鶴』。只因筆記本封面上有它的畫像,『小雪鶴』就當成是它的『東西』了。那『小雪鶴』南渡之時,偶入『雲夢古澤』,失其同伴,一時驚慌,就把這本筆記本給落在那兒了。作者因考『雲鄉』舊事,恰入夢拾,得展頁而讀,原來是 M♪o 用 TUX 語寫的課堂學習筆記,覺得內容有趣,或可以利益學者,便將之改寫成『 M♪o 之學習筆記本』,希望別惹惱了 M♪o 才好。為表尊重原著者,

企鵝與派生碼訊0

,立其自畫像以為印記。

編輯排版按造原著形式,此處祇舉其第一篇為例,如下︰

M♪o 之學習筆記本《子》開關

派生碼訊

子 鼠

蕩蕩天門萬古開,
幾人歸去幾人來。
山河雖好非完璧,
不信黃金是禍胎。

子鼠︰ 兩態系統是數位設計之本。數學完整的編碼體系,布林代數為集其大成者也。

 

這本 M♪o 的筆記內容有個特別章法,上有總綱,比方說

子 鼠 子鼠︰ 兩態系統是數位設計之本。數學完整的編碼體系,布林代數為集其大成者也。

,內容分成 派派、生生、碼碼、訊 訊四段,以 派 記一主題之科學原理;

生 寫總綱之學習要點;

碼 編程式練習實作;

訊 知與行後之反思。

不過起頭上之

派生碼訊

蕩蕩天門萬古開,
幾人歸去幾人來。
山河雖好非完璧,
不信黃金是禍胎。

梅花詩』,作者不知是筆記紙張原有,還是 M♪o 填寫上去的,對於梅花詩來歷有興趣的讀者,請參造《 踏雪尋梅!! 》一文。此番改寫,大體都還好說,但是如果沒有 □□ 的硬體,那個 碼的部分該怎麽辦呢?或將之『留白』!想來總覺遺憾。因是之故,蓋詢之『跂礄』 Sandal 之友,竟告知一尚未發行的『沒有之物』,當真難矣哉!既然那 ○○ 之物,已經有了 DIY 教程,或許離上市不遠,何不就嘗試作此『辜妄之言』,『以文會文』的奇事!?