M♪o 之學習筆記本《巳》文章︰【䷡】藩決不羸

派生碼訊

巳 蛇

來氏《 易 》易註︰

九四,貞吉,悔亡。藩決不羸,壯于大輿之輹。

貞吉悔亡者,惟正則吉,而悔亡也。決,破也,藩決不羸,承上文而言也。三前有四之阻隔,猶有藩焉。四前二陰,則藩決而可前進矣。震為大塗,兌為附決,藩決之象也。輹與輻同,車輪之中幹也。車之敗,常在折輹,輹壯則車強。四變坤,大輿之象也。壯于大輿之輹,言尚往而可進也。此二句,又貞吉悔亡之象也。

九四當大壯之時,以陽居陰,不極其剛,前無困阻,而可以尚往矣,故其占中之象如此 。

《象》曰:藩決不羸,尚往也。

尚往者,前無困阻,而可以上進也。

︰《 易 》易《序卦》說:遯者退也,物不可以終遯,故受之以大壯。

今天學堂的氣氛輕鬆活潑。有的教室內外忙來忙去,試驗紅外線的發射與接收距離與失誤率。有的三五成群的作主題討論和程式研習 。也許因為昨兒受到學長的 鼓舞 舞,以及 啟發 發,激起了彼此之好奇心與共同探索的熱情。

只見學長跟著幾位同學從休息室那邊走來。

 

派︰同學們,大家好。【漸次歸座,安靜下來】

學長笑著講︰今早有幾位同學跑到休息室搗蛋,說是驗證遙控器的『靈敏度』,不過倒像是考察學長有沒有『 密 密而藏私』。就請你們說說發現了什麼?同學們答︰遙控器在休息室裡,操作的比較順暢正常。那你們是說︰果然我有不傳之 秘 秘的咯!其實昨天要大家『研究』

一、為何沒有 KEY_LEFT、KEY_RIGHT、KEY_UP、KEY_DOWN 卻還能左右上下的呢?

二、遙控器難以操控的原因?

三、可以用 irsend 來控制嗎?

那些『問題』, 就已經講出了『答案』。

假使觀察 LIRC 開機訊息

pi@raspberrypi ~ $ dmesg | grep lirc
[    5.266731] lirc_dev: IR Remote Control driver registered, major 246 
[    5.273095] lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned.
[    6.226176] lirc_rpi: auto-detected active low receiver on GPIO pin 9
[    6.226741] lirc_rpi lirc_rpi: lirc_dev: driver lirc_rpi registered at minor = 0
[    6.226763] lirc_rpi: driver registered!
[    7.636280] input: lircd as /devices/virtual/input/input2

,你將看到『/devices/virtual/input/input2』 這個『虛擬鍵盤』類的輸入裝置。這也就是問題一與二的主要原由。一旦設定了 Kodi 之遙控器支援檔案『Lircmap.xml』和『remote.xml』,每按一次鍵, Kodi 將能從兩方各收到一次按鍵,這就是難以操控的原因。只要將那兩個檔案『刪除』就好了!

『知識』往往因為

好奇 → 探索 → 疑問 → 研究 → 而發現

,關鍵常常來自『疑問』,與『已知的』或『熟悉的』衝突。通常需要審慎的分辨。

至於第三個問題,並非單問 irsend 可以不可以?當然可以,如果看 TuxIOme 的 irsend 程式片段︰

重複次數 = 1

def 紅外線輸出(字碼):
    global 重複次數
    subprocess.call(['irsend', 'SEND_ONCE', 'tuxiome', 字碼,"--count=" +str(重複次數) ])
    return "已送出"

 

,預設是『送一次』,可能發生『收不到』的問題;若是『送多次 』又可能發生『收多次』的麻煩!這就造成類似 Kodi 這種程式操作的不順暢!!所以會有 軟體『過濾器』 ── 去除不要的資訊 ── 以及『轉換器』 ── 將此種型態的輸入轉成彼類型態的輸出 ── 等等想法,試圖解決那個『兩難』。就像用 IREXECXDOTOOL 這些工具解決『問題』一樣。

如果將此處的『解析』,用於論述『明文』或『密訊』的『發文』與『收文』之程式,將可知『收發規範』的『必要性』,否則訊息『內容』的『對錯』根本就沒有 譜 譜了的。思考如下︰

《起始碼》+   【《資料碼》+   《空白碼》+ 】*    《結束碼》+

《KEY_SETUP》+   [《KEY_0 … KEY_9》+  《KEY_ENTER》+ ] *     《KEY_BACK》+

之規範目的,也許方是設計『穩定性』高的『傳輸』程式的第一步 。

用自己能『理解』以及能『驗證』的方式寫程式;就像用『通熟』和『清楚』的文字作表達一樣。這也就是跟,面對『未知』時,『科學家』也是藉著『實驗』與『假設』的『思維方法』相同。

 

生 ︰同學們下禮拜一將舉行 同 樂 會同樂會 ,拋帽大喊 ─ 我畢業了─ 。現在就請大家繼續 遊 習 遊習。 散會。

DS18B20 Digital temperature sensor

  • Description

    These 1-wire digital temperature sensors are fairly precise (±0.5°C over much of the range) and can give up to 12 bits of precision from the onboard digital-to-analog converter. They work great with any microcontroller using a single digital pin, and you can even connect multiple ones to the same pin, each one has a unique 64-bit ID burned in at the factory to differentiate them. Usable with 3.0-5.0V systems.The only downside is they use the Dallas 1-Wire protocol, which is somewhat complex, and requires a bunch of code to parse out the communication. There’s a great Arduino library for 1-Wire, but some microcontrollers do not have support for 1-Wire so be sure to check!

    We toss in a 4.7k resistor, which is required as a pullup from the DATA to VCC line when using the sensor. We don’t have a detailed tutorial up yet but you can get started by using the Dallas Temperature Control Arduino library which requires also the OneWire Library.

  • Technical Details

    Technical specs:

    • Usable temperature range: -55 to 125°C (-67°F to +257°F)
    • 9 to 12 bit selectable resolution
    • Uses 1-Wire interface- requires only one digital pin for communication
    • Unique 64 bit ID burned into chip
    • Multiple sensors can share one pin
    • ±0.5°C Accuracy from -10°C to +85°C
    • Temperature-limit alarm system
    • Query time is less than 750ms
    • Usable with 3.0V to 5.5V power/data

    Downloads:

    DS18B20 Datasheet

……

 

Overview

The Occidentalis Linux distribution for Raspberry Pi (and Raspbian as of Dec 2012) includes support for the DS18B20 1-wire temperature sensor. These sensors come in a small three pin package like a transistor and are accurate digital devices.

In this lesson, you will learn how to use a DS18B20 with the Raspberry Pi to take temperature readings.

Since the Raspberry Pi has no ADC (Analog to Digital Converter), it cannot directly use an analog temperature sensor like the TMP36, making the DS18B20 a good choice for temperature sensing.

……

W1ThermSensor

Gitter

This little pure python module provides a single class to get the temperature of a w1 therm sensor
It can be easily used on are Rasperry Pi over the GPIO interface.


Build Status

Author: Timo Furrer tuxtimo@gmail.com
Version: 0.2.2

Supported devices

The following w1 therm sensor devices are supported:

  • DS18S20
  • DS1822
  • DS18B20

Setup

You just need a w1 therm sensor.
Some of them can be bought here: Adafruit: DS18B20
I’ve used a Raspberry Pi with an GPIO Breakout (Pi Cobbler)

Installation

From Source

git clone https://github.com/timofurrer/w1thermsensor.git && cd w1thermsensor
python setup.py install

Note: maybe root privileges are required

From PIP

pip install w1thermsensor

Note: maybe root privileges are required

……

 

碼 ︰園 園 習 。☿ 長 長︰同學們請安靜。既然學長說了 遊 習 遊習,我們何不效法『古風』 ── 校際觀摩 ── 之法 ,大家各以『主題』自立 旗 旗幟,來個『決藩』 園 園習!看看到底『羸還不羸』的呢?【鼓掌通過】

……
訊 ︰☿ 又誰不知即將各自西東?卻為南北相隔彼此情痛!