W!o+ 的《小伶鼬工坊演義》︰小樹林系統之舒適度【下】

雖然

Grove – Temperature and Humidity Sensor Pro

中文 Go pro in temperature and relative humidity measurement applications with this Grove gadget. This is a powerful sister version of our Grove – Temperature and Humidity Sensor. It has more complete and accurate performance than the basic version. The detecting range of this sensor is 5% RH – 99% RH, and -40°C – 80°C. And its accuracy satisfyingly reaches up to 2% RH and 0.5°C. A professional choice for applications that have relatively strict requirements.

Temp_humi_pro

Specification

Item Parameter Min Norm Max Unit
VCC 3.3 6 V
Measuring Current Supply 1 1.5 mA
Standby Current Supply 40 50 uA
Measuring range Humidity 5% 99% RH
Temperature -40 80 °C
Accuracy Humidity ±2% RH
Temperature ±0.5 °C
Resolution Humidity 0.1% RH
Temperature 0.1 °C
Repeatability Humidity ±0.3% RH
Temperature ±0.2 °C
Long-term Stability ±0.5% RH/year
Signal Collecting Period 2 S
Respond Time 1/e(63%) 6 20 S

───

 

是連接在『小樹林系統』之『數位埠』上,但是只要粗略考察 Grove System 派生界面原始碼︰

GrovePi/Software/Python/grovepi.py

# line 284
# Read and return temperature and humidity from Grove DHT Pro
def dht(pin, module_type):
        write_i2c_block(address, dht_temp_cmd + [pin, module_type, unused])

        # Delay necessary for proper reading fron DHT sensor
        time.sleep(.6)
        try:
                read_i2c_byte(address)
                number = read_i2c_block(address)
                time.sleep(.1)
                if number == -1:
                        return -1
        except (TypeError, IndexError):
                return -1
        # data returned in IEEE format as a float in 4 bytes

        if p_version==2:
                h=''
                for element in (number[1:5]):
                        h+=chr(element)

                t_val=struct.unpack('f', h)
                t = round(t_val[0], 2)

                h = ''
                for element in (number[5:9]):
                        h+=chr(element)

                hum_val=struct.unpack('f',h)
                hum = round(hum_val[0], 2)
        else:
                t_val=bytearray(number[1:5])
                h_val=bytearray(number[5:9])
                t=round(struct.unpack('f',t_val)[0],2)
                hum=round(struct.unpack('f',h_val)[0],2)
        return [t, hum]

 

以及韌體 Source Code ︰

【 GrovePi/Firmware/Source/v1.2/grove_pi_v1_2_5/DHT.cpp

# line 82
boolean DHT::read(void) {
  uint8_t laststate = HIGH;
  uint8_t counter = 0;
  uint8_t j = 0, i;
  unsigned long currenttime;

  // pull the pin high and wait 250 milliseconds
  digitalWrite(_pin, HIGH);
  delay(250);

  currenttime = millis();
  if (currenttime < _lastreadtime) {
    // ie there was a rollover
    _lastreadtime = 0;
  }
  if (!firstreading && ((currenttime - _lastreadtime) < 2000)) {
    return true; // return last correct measurement
    //delay(2000 - (currenttime - _lastreadtime));
  }
  firstreading = false;
  /*
    Serial.print("Currtime: "); Serial.print(currenttime);
    Serial.print(" Lasttime: "); Serial.print(_lastreadtime);
  */
  _lastreadtime = millis();

  data[0] = data[1] = data[2] = data[3] = data[4] = 0;

  // now pull it low for ~20 milliseconds
  pinMode(_pin, OUTPUT);
  digitalWrite(_pin, LOW);
  delay(20);
  cli();
  digitalWrite(_pin, HIGH);
  delayMicroseconds(40);
  pinMode(_pin, INPUT);

  // read in timings
  for ( i=0; i< MAXTIMINGS; i++) {
    counter = 0;
    while (digitalRead(_pin) == laststate) {
      counter++;
      delayMicroseconds(1);
      if (counter == 255) {
        break;
      }      
    }
    laststate = digitalRead(_pin);

    if (counter == 255) break;

    // ignore first 3 transitions
    if ((i >= 4) && (i%2 == 0)) {
      // shove each bit into the storage bytes
      data[j/8] <<= 1;
      if (counter > _count)
        data[j/8] |= 1;
      j++;
    }
  }

  sei();

  /*
  Serial.println(j, DEC);
  Serial.print(data[0], HEX); Serial.print(", ");
  Serial.print(data[1], HEX); Serial.print(", ");
  Serial.print(data[2], HEX); Serial.print(", ");
  Serial.print(data[3], HEX); Serial.print(", ");
  Serial.print(data[4], HEX); Serial.print(" =? ");
  Serial.println(data[0] + data[1] + data[2] + data[3], HEX);
  */

  // check we read 40 bits and that the checksum matches
  if ((j >= 40) &&
      (data[4] == ((data[0] + data[1] + data[2] + data[3]) & 0xFF)) ) {
    return true;
  }


  return false;

}

 

就可以發現這可不是簡單的『 0 』與『 1 』狀態而已,而是一種『單線』 One Wire 種類之『存取規範』。因此必須細讀 AM2302 溫‧濕度感測器之 Data Sheet ︰

TH_One_Wire_P1

TH_One_Wire_P2

TH_One_Wire_P3

 

才能了解與解讀韌體寫作的程式邏輯。

雖說樹莓派上也有

1-Wire

1-Wire is a device communications bus system designed by Dallas Semiconductor Corp. that provides low-speed data, signaling, and power over a single signal.[1] 1-Wire is similar in concept to I²C, but with lower data rates and longer range. It is typically used to communicate with small inexpensive devices such as digital thermometers and weather instruments. A network of 1-Wire devices with an associated master device is called a MicroLAN.

One distinctive feature of the bus is the possibility of using only two wires: data and ground. To accomplish this, 1-Wire devices include an 800 pF capacitor to store charge, and to power the device during periods when the data line is active.

───

 

GPIO 界面,之前在《勇闖新世界︰ 《 Kernel 4.X 》之整裝蓄勢‧事件驅動 →→ 設備管理及應用》文本中也曾談過︰

最後就讓我們再次回到『DS18B20』數位環境溫度感測器,當我們已經設定了『w1-gpio』的 dtoverlay ,也安裝了感測器,我們怎麼知道裝置正確工作了呢?也許可以用

pi@raspberrypi ~ dmesg | grep w1-gpio [    4.955057] w1-gpio onewire@0: gpio pin 4, external pullup pin -1, parasitic power 0 [    4.955143] w1_add_master_device: set_pullup requires write_byte or touch_bit, disabling</pre> <span style="color: #808000;">來作初步確認。再用下面辦法『讀取溫度』作驗證</span> <pre class="lang:sh decode:true "># w1-gpio 裝置的『基底』 base 目錄 pi@raspberrypi ~ cd /sys/bus/w1/devices/

# 28-021463ab43ff 某個『DS18B20』數位環境溫度感測器
pi@raspberrypi /sys/bus/w1/devices ls 28-021463ab43ff  w1_bus_master1  # 裝置目錄 pi@raspberrypi /sys/bus/w1/devices cd 28-021463ab43ff
pi@raspberrypi /sys/bus/w1/devices/28-021463ab43ff ls driver  id  name  subsystem  uevent  w1_slave  # 讀取裝置名稱 pi@raspberrypi /sys/bus/w1/devices/28-021463ab43ff cat name
28-021463ab43ff

# 第一行的 YES 代表第二行溫度取得正確,若是 NO 代表溫度取得錯誤。
# 讀取溫度, t=35937 意味 35937/1000 = 35.937 °C
pi@raspberrypi /sys/bus/w1/devices/28-021463ab43ff 
*** QuickLaTeX cannot compile formula:
cat w1_slave 
3f 02 55 00 7f ff 0c 10 89 : crc=89 YES
3f 02 55 00 7f ff 0c 10 89 t=35937
</pre>
<span style="color: #808000;">這 個古怪的『類檔案裝置界面』顯然不怎麼對『使用者友善』 user friendly ,要是想一想所謂的『API』,指應用程式界面,原本就是設計給『程式』用的,自然就可以釋懷的了。即使是『程式』應用 ,『界面』也有使用上方便與否的問題,所以為『界面』再寫個易使用的『程式庫』,包裹成易記易讀的『新界面』也是常有的事。《 <a href="https://www.freesandal.org/?m=20150626"><span style="color: #808000;">M♪o 之學習筆記本《巳》文章︰【䷡】藩決不羸</span></a>》文本裡的 《<a href="https://github.com/timofurrer/w1thermsensor"><span style="color: #808000;">W1ThermSensor</span></a>》 就是這一類的『程式庫』。建議讀者閱讀它的『原始碼』《<a href="https://github.com/timofurrer/w1thermsensor/blob/master/w1thermsensor/core.py"><span style="color: #808000;">core.py</span></a>》,思索設備『應用』以及『管理』方法,或將能夠對『程式實務』有更深的認識耶!</span>!

───

 

<span style="color: #666699;">畢竟類似歸類似,規範不同,『 w1-gpio 』恐難以介接也!所以說即使只是『一根』數位線而已,其內可能之文章,當真『大哉問』的耶?再者若從此感測器『規範』之『時序條件』需求來講,想自樹莓派直接以 Digital Read/Write 方式來控制,也是不切實際的了 !!??</span>

<span style="color: #666699;">就像『室內舒適度』雖然可以假設為</span>

<span style="color: #808080;">風速接近於零</span>

<span style="color: #666699;">。且將<a style="color: #666699;" href="http://www.twwiki.com/wiki/%E4%BA%BA%E9%AB%94%E8%88%92%E9%81%A9%E5%BA%A6%E6%8C%87%E6%95%B8">人體舒適度指數</a>︰</span>

*** Error message:
You can't use `macro parameter character #' in math mode.
leading text: <span style="color: #
Unicode character 這 (U+9019)
leading text: <span style="color: #808000;">這
Unicode character 個 (U+500B)
leading text: <span style="color: #808000;">這 個
Unicode character 古 (U+53E4)
leading text: <span style="color: #808000;">這 個古
Unicode character 怪 (U+602A)
leading text: <span style="color: #808000;">這 個古怪
Unicode character 的 (U+7684)
leading text: ...n style="color: #808000;">這 個古怪的
Unicode character 『 (U+300E)
leading text: ...tyle="color: #808000;">這 個古怪的『
Unicode character 類 (U+985E)
leading text: ...e="color: #808000;">這 個古怪的『類
Unicode character 檔 (U+6A94)
leading text: ...color: #808000;">這 個古怪的『類檔

SSD \ = \ (1.818 \times \ T \ + \ 18.18) \times \ (0.88 \ + \ 0.002 \ \times \ H) \ + \ \frac{(T \ - \ 32)}{(45 \ - \ T)} \ - \ 3.2 \times \ W \ + \ 18.2<span style="color: #808080;">此處 T 是攝氏平均溫度, H 是相對濕度, W 是風速【m/s】</span>     <span style="color: #666699;">公式改寫為</span>(1.818 \times \ T \ + \ 18.18) \times \ (0.88 \ + \ 0.002 \ \times \ H) \ + \ \frac{(T \ - \ 32)}{(45 \ - \ T)} \ + \ 18.2$

 

就好!若問程式『加寫』在哪好呢?依舊是『費思量』的哩???

 

 

 

 

 

 

 

 

 

 

 

 

 

W!o+ 的《小伶鼬工坊演義》︰小樹林系統之舒適度【上】

在談談如何用『小樹林系統』之『感測器』測量『舒適度』之前,需知『氣候變遷』不止引發了『過冷』、『過熱』、『洪水』、『乾旱』、『強風』、『驟雨』…… 等等現象。雨林的消失、火耕的污染、石化燃料的霾害,在在使人不得不重視

懸浮粒子之危害︰

懸浮粒子 (Atmospheric particulate matter, particulate matter (PM), particulates),在環境科學中,特指懸浮在空氣中的固體顆粒或液滴 ,是空氣污染的主要來源之一。其中,空氣動力學直徑(以下簡稱直徑)小於或等於10微米 (µm)的懸浮粒子稱為可吸入懸浮粒子PM10);直徑小於或等於2.5微米的懸浮粒子稱為細懸浮粒子PM2.5)。懸浮粒子能夠在大氣中停留很長時間,並可隨呼吸進入體內,積聚在氣管中,影響身體健康。

Airborne-particulate-size-chart

各種顆粒大小,微米(µm)。【縱軸】 biological contaminants 生物污染物 types of dust 灰塵的類型 particulate contaminants 顆粒污染物 gas molecules 氣體分子。【橫軸】pollen 花粉 mold spores 黴菌孢子 house dust mite allergens 屋塵蟎過敏原 bacteria 細菌 cat allergens 貓過敏原 virus 病毒 heavy dust 沉重的灰塵 setting dust 沉澱灰塵 suspended atmospheric dust 懸浮大氣塵 cement dust 水泥粉塵 fly ash 煤灰 oil smoke 油煙 smog 煙霧 tobacco smoke 香菸煙霧 soot 煤煙 gaseous contaminants 氣態污染物。

……

這個動畫顯示從2006年8月17日至2007年4月10日,主要對流層懸浮微粒光學厚度的射出與運送。[1][2] (click for more detail)
* 綠色:黑色和有機碳
* 紅/橙:灰塵
* 白:硫酸鹽
* 藍:海鹽

───

懸浮微粒的分布影片圖,根據美國航天局的特拉衛星中等解析度成像光譜儀的數據。
* 綠色區域顯示了較大的顆粒為主的懸浮微粒。
* 紅色區域由小顆粒懸浮微粒為主。
* 黃色區域顯示大,小混合的懸浮微粒。
* 灰色顯示了傳感器並沒有收集數據。

───

 

試問在一個『呼吸都嫌困難』之環境裡,又將怎麼談『舒適度』的呢??

其次棌用之公式人體舒適度指數

SSD \ = \ (1.818 \times \ T \ + \ 18.18) \times \ (0.88 \ + \ 0.002 \ \times \ H) \ + \ \frac{(T \ - \ 32)}{(45 \ - \ T)} \ - \ 3.2 \times \ W \ + \ 18.2

此處 T 是攝氏平均溫度, H 是相對濕度, W 是風速【m/s】

 

雖有出處,卻是來源不明!!讀者或可參考

气候变化对旅游气候舒适度的影响

這篇論文的說法︰

人體舒適度指數

 

若是有志於此者,也可讀讀瑞典 Håkan O Nilsson 大部頭 Thesis

Comfort Climate Evaluationwith Thermal Manikin Methodsand Computer Simulation Modes

 

無論『舒適度』是否主以『熱』為中心來論述,終將及於『濕度』 、『風速』等等因素,還需以『人』為重來對待。這明確的說明了我們在此關心的不祇『物理量』之測量問題,而是『物理量』它與『生命』的『關係』。就像

空氣也有品質尺度

import time
import grovepi

# Connect the Grove Air Quality Sensor to analog port A0
# SIG,NC,VCC,GND

# 感測器之『入出埠』
air_sensor = 0

# 此『感測器』是『輸入』
grovepi.pinMode(air_sensor,"INPUT")

while True:
    try:
        # Get sensor value
# 此『感測器』是『Analog』
        sensor_value = grovepi.analogRead(air_sensor)

# ☆☆ 品質尺度

        if sensor_value > 700:
            print "High pollution"
        elif sensor_value > 300:
            print "Low pollution"
        else:
            print "Air fresh"

        print "sensor_value =", sensor_value
        time.sleep(.5)

    except IOError:
        print "Error"

 

一樣。

 

 

 

 

 

 

 

 

 

 

 

 

 

W!o+ 的《小伶鼬工坊演義》︰小樹林系統之舒適感

在《M♪o 之 TinyIoT 《起承轉合》之未來鳥瞰!!》文本中,我們談及『自生自成』 autopoesis 系統之幾方觀點,歸結到

當然終究有人落在『生命』之『意義的起源』的探討︰

生命的自创生:认知科学家弗朗西斯科·瓦雷拉

陈巍,郭本禹
南京师范大学心理学系,南京,210097
Email:anti-monist@163.com; antimonist@yahoo.cn

摘 要:弗朗西斯科·瓦雷拉是智利著名认知科学家。20 世纪 70 年代初他与亨伯特·马图拉纳提出了著名的自创生理论。通过回溯并分析自创生理论的由来、内涵与证据,揭示了该理论的精髓:“生命系统是自创生的”、“活着即是认知”与“活着即是意义的生成”,并考察了其在认识生命本质与运作规律、区分生命系统与非生命系统、推动认知科学发展等方面的意义。

关键词:瓦雷拉;生命系统;自创生;活着即是认知;活着即是意义的生成

Life’s Autopoiesis: Cognitive Scientist Francisco Varela
Wei Chen, Benyu Guo
Psychology Department, Nanjing Normal University, Nanjing
Email:anti-monist@163.com; antimonist@yahoo.cn

Abstract: Francisco Varela is a famous Chilean cognitive scientist. In the early 1970’s, Varela and Humberto R. Maturana cosponsored the famous “theory of autopoiesis”. This paper, based on the retrospection and analyzing of the origin, connotation and relevant evidence of the theory of autopoiesis, revealed its essence: “living system is autopoietic”, “living is cognition” and “living is sense- making”, and also appreciated the significance of theory of autopoiesis on realizing the essence of life, division of living system and non-living system, as well as driving the development of cognitive science.

Keywords: Varela; Living System; Autopoiesis; Living is Cognition; Living is Sense-making

 

該文作者引用『瓦雷拉』之『細菌』

生命的自创生:认知科学家弗朗西斯科·瓦雷拉_1

生命的自创生:认知科学家弗朗西斯科·瓦雷拉_2

 

會努力朝向『糖』最密集之處,說明『生命』的『感知』視角,『意義』升起的激活情境,『價值』創造的整體環境!!在這種『詮釋』下,生命體之『感測器』並不只以『理化量測』為依歸,而是『生命意義』的『認知度量』耶??

由是『絕對溫度』之物理實質,與『冷熱感覺』的生命效用,就成了不同的層面,因而人們也就自然地談著

體感溫度

原理

空氣對熱的吸收會受到相對濕度及其密度影響;而風速會影響到與人體表面可以接觸到的空氣的分量,當風速增加時,與人體所接觸的空氣會增加,所以其所帶走或帶來的熱量亦相應地增加,這現象便是「風寒指數」。因此,在天氣報告裡,會把這兩個變數帶來的影響計算進「酷熱指數」裡。一般來說,當空氣密度及濕度增加,都會使酷熱指數增加。

人體等於浸泡在空氣的水分子中,所以比體溫高溫的水分子會阻礙人體散熱,而比體溫低溫的水分子會加速人體散熱,濕度愈高空氣中的水分子濃度愈高,水分子所造成的效應也愈明顯。

THW指數

由於體感溫度可以受到溫度、濕度及風速的影響,這個數值又名「THW指數」(Temperature-Humidity-Wind Index)。1958年 ,美國的Paul Siple曾就風對人體的熱流失成正比例[1]。根據這說法和當時計算風寒指數的公式,簡化出以下的一條算式:

體感溫度(°C)=溫度(°C)-2√風速(公尺/每秒)。

由於和地面的距離所影響的是用溫度計可以量度出來的溫度差異,其差異不計算進體感溫度。

───

 

的氣象『報導』。想要深入它的物理、化學、生理基礎︰

Temperature, Humidity, Winds, and Human Comfort

Within the human body, energy is produced by the metabolism of foods. Approximately 1800 kilocalories of energy per day is metabolized by the average person while resting, more if doing strenuous activities. Over half of this energy is converted to heat. Without some way to remove this internally-produced heat energy, the body temperature would increase indefinitely. Under certain atmospheric conditions (high temperature and high humidity), it becomes difficult for the body to remove this excess heat.

In the other extreme, problems also arise when the body loses heat too rapidly under conditions of cold temperatures and strong winds. Thermoregulation refers to the processes by which the human body regulates internal heat generation and external heat exchange so that its core temperature varies by no more than 2°C from its average of 37°C. “Core” refers to vital organs such as the brain, heart, kidneys, etc. If the body’s core temperature moves outside of this range, essential life functions do not work properly.

Surprising to many, exposure to extreme heat and cold are responsible for more human deaths per year than all other weather disasters (e.g., thunderstorms, tornadoes, hurricanes, blizzards) combined.

The ideal conditions for a resting human body fall into a range called the thermalneutral zone, where the air temperature is between 20°C and 25°C, or (68-77)°F, with little wind and moderate relative humidity. Under these conditions, a resting body can easily maintain its core temperature. Outside of this narrow range, the body’s thermoregulation responses take over.

Biological Control Systems

Living things, like mechanical engines, need regulators for effective operation. The regulators of living things are called biological control systems. Many homeostatic biological control systems are at work in the body. Homeostasis is the stable operation of physiological activities.

Control systems maintain a balance in the biophysical and biochemical functioning of the body. An important system is thermoregulation, which keeps the internal body temperature at a stable level in all kinds of weather.

Over half of all energy from food and other sources leaves the body as heat. Thus, the body needs a well-functioning homeostatic control system for thermal regulation.

Enzyme-controlled biochemical reactions in the body are usually most efficient at around 98°F (37°C). This temperature is the average set point for the inner body temperature of mammals. The flow diagram below shows how the body reacts to heat-related stresses.

This heat stress, or load, is a disturbance of the thermoregulatory system. The disturbance can be (a) internal temperature too high or (b) internal temperature too low. The body compensates for it in the following ways:

Response to cold core temperature

  1. Increase internal heat production by shivering (involuntary muscle contractions)
  2. Reduce heat loss by vasoconstriction (constrict blood vessels). Vasoconstriction reduces blood (and heat) flow to extremities. Thus, extremeties (forearms, lower legs) cool down. This reduces heat loss since temperature difference between extremities and outside world is less. It also reduces the surface area of warm blood that is in contact with the outside air. In severe cases this can lead to frostbite of extremities (freezing of skin).

Response to warm core temperature

  1. Sweating – body cooled by evaporation. Important to drink enough water in hot weather. This is by far the best way to lose heat. In fact, sweating is the only means by which humans can survive for long periods when the air temperature exceeds body temperature.
  2. Increase heat loss by vasodilation (widening of blood vessels). Vasodilation increases blood (and heat) flow to extremities allowing more rapid heat transfer away from body. This exposes warm blood to the outiside air over a larger surface area. NOTE: this only works if the air temperature is lower than the body temperature. If air temperature is warmer than body temperature, vasodilation would actually result in heat flow from air to blood.

These reactions are programmed by the brain’s hypothalamus via information fed back from its own thermoreceptors and from thermoreceptors in the skin. Thermoregulation has a high set point, about 98°F, an indication that it is easier for the body to heat itself than to cool itself.

Thermoregulation and other forms of homeostasis do not maintain a condition at an unvarying level, but within an acceptable range. For example, most people experience a slight daily temperature variation during which body temperature dips nearly two degrees Fahrenheit (one degree Celsius) from an early evening peak to an early morning low.

The Control systems by which the brain directs the body’s automatic responses to elevated or lowered core temperature are illustrated in this figure.

……

 

試圖打造

人體舒適度指數

研究表明,影響人體舒適程度的氣象因素,首先是氣溫,其次是濕度,再其次就是風向風速等。能反映氣溫、濕 度、風速等綜合作用的生物氣象指標,人體感受各不相同。人體舒適度指數就是建立在氣象要素預報的基礎上,較好地反映多數人群的身體感受綜合氣象指標或參 數。人體舒適度指數預報,一般分為10個等級對外發布。10級,稍冷。9級,偏冷,舒適。8級,涼爽,舒適。7級,舒適。6級,較舒適。5級,較熱。4 級,早晚舒適,中午悶熱。3級,中午炎熱,夜間悶熱。2級,悶熱,謹防中暑。1級,非常悶熱,嚴防中暑。

 

人體舒適度指數(ssd)=(1.818t+18.18)(0.88+0.002f)+(t-32)/(45-t)-3.2v+18.2。
其中t為平均氣溫,f為相對濕度,v為風速。

 

人體舒適度指數分級  

 

86—88,4級
人體感覺很熱,極不適應,希注意防暑降溫,以防中暑;

 

80—85,3級
人體感覺炎熱,很不舒適,希注意防暑降溫;

 

76—79,2級
人體感覺偏熱,不舒適,可適當降溫;

 

71—75,1級
人體感覺偏暖,較為舒適;

 

59—70,0級
人體感覺最為舒適,最可接受;

 

51—58,-1級
人體感覺略偏涼,較為舒適;

 

39—50,-2級
人體感覺較冷(清涼),不舒適,請注意保暖;

 

26—38,-3級
人體感覺很冷,很不舒適,希注意保暖防寒;

 

<25,-4級
人體感覺寒冷,極不適應,希注意保暖防寒,防止凍傷。

───

 

的了。或應更深入的探究

Thermal comfort

Thermal comfort is the condition of mind that expresses satisfaction with the thermal environment and is assessed by subjective evaluation (ANSI/ASHRAE Standard 55).[1] Maintaining this standard of thermal comfort for occupants of buildings or other enclosures is one of the important goals of HVAC (heating, ventilation, and air conditioning) design engineers.

Thermal neutrality is maintained when the heat generated by human metabolism is allowed to dissipate, thus maintaining thermal equilibrium with the surroundings. The main factors that influence thermal comfort are those that determine heat gain and loss, namely metabolic rate, clothing insulation, air temperature, mean radiant temperature, air speed and relative humidity. Psychological parameters such as individual expectations also affect thermal comfort.[2]

The Predicted Mean Vote (PMV) model stands among the most recognized thermal comfort models. It was developed using principles of heat balance and experimental data collected in a controlled climate chamber under steady state conditions.[3] The adaptive model, on the other hand, was developed based on hundreds of field studies with the idea that occupants dynamically interact with their environment. Occupants control their thermal environment by means of clothing, operable windows, fans, personal heaters, and sun shades.[2][4]

The PMV model can be applied to air conditioned buildings, while the adaptive model can be generally applied only to buildings where no mechanical systems have been installed.[1] There is no consensus about which comfort model should be applied for buildings that are partially air conditioned spatially or temporally.

Thermal comfort calculations according to ANSI/ASHRAE Standard 55[1] can be freely performed with the CBE Thermal Comfort Tool for ASHRAE 55.

───

 

,好好玩玩 柏克萊加大之線上工具

CBE Thermal Comfort Tool

 

 

 

 

 

 

 

 

 

 

 

 

 

 

W!o+ 的《小伶鼬工坊演義》︰小樹林系統之出入埠

來知德《周易集註》

䷗  震下坤上

復者,來復也。自五月一陰生後,陽一向在外,至十月變坤,今冬至復來反還于內,所以名復也。《序卦》「物不可以終盡剝,窮上反下,故受之以復」,所以次剝。

 

復,亨,出入无疾,朋來无咎,反復其道,七日來復,利有攸往。

先言出而後言入者,程子言:語順是也。出者剛長也,入者剛反也 ,疾者遽迫也。言出而剛長之時,自一陽至五陽,以漸而長,是出之時未嘗遽迫也。入而剛反之時,五月一陰生,九月之剝,猶有一陽,至十月陽變,十一月陽反,以漸而反,是入之時,未嘗遽迫也 。朋者,陰牽連于前,朋之象也。故豫卦損卦益卦泰卦咸卦,皆因中爻三陽三陰牽連,皆得稱朋也。自外而之內曰來,言陰自六爻之二爻,雖成朋黨而來,然當陽復之時,陽氣上行,以漸而長,亦無咎病也。復之得亨者以此。道猶言路,言剛反而復之道路也。七日來復者,自姤而遯否觀剝坤復,凡七也,即七日得之意。蓋陽極于六,陰極于六,極則反矣,故七日來復也。无疾咎者, 復之亨也。七日來復,復之期也。利有攸往,復之占也。大抵姤復之理,五月一陰生為姤,一陰生于內則陽氣浮而在外矣。至于十月坤,陰氣雖盛而陽氣未嘗息也, 但在外耳,譬之妻雖為主,而夫未嘗亡,故十一月一陽生,曰剛反,反者言反而歸之于內也。十一月一陽生而復 ,一陽生于內則陰氣浮而在外矣。至于四月乾,陽氣 雖盛而陰氣未嘗息也,但在外耳,譬之夫雖為主,而妻未嘗亡,故五月一陰復生 ,天地雖分陰陽,止是一氣,不過一內一外而已。一內一外即一升一沉,一盛一衰, 一代一謝也。消息盈虛,循環無端,所以言剝言復。

 

雖然一張『小樹林系統』之圖說︰

GrovePi-Port-description

就能清楚表達 Grove System 各種類型的『出入』埠。其中 GrovePi Serial 我們暫且用作了『除錯埠』, I2C 與 Raspberry Pi Serial 通常介接的『感測器』或『使用者界面』元件並非透過『小樹林系統』之韌體直接控制。從這個角度來講,也許此系統最重要的『界面』就由『數位』 Digital 與或『類比』 Analog 所構成的了。

雖說『數位』 和『類比』是『單純』的概念,不過『單純』的事物卻未必『簡單』,類似『純數據』 Pure Data 程式語言裡『箱子』的概念一樣︰

『箱子』 boxes 是一個『奧秘』的觀點,有如《打開黑箱!!》之所言︰

科學追求真理,為的是打開大自然的黑箱;然而真理明白若昭,就是透明的白箱。我們總在求真的旅途上一知半解,努力灰箱為白箱。如果偵錯就是科學,除錯即求真理,那這一段話用在『偵錯』與『除錯』上來講依然合適。這也說明為什麼人們喜歡用不同的灰度,來表達對『箱內之物』的認識與了解了。

………

千萬不要隨便對

Black box

In science, computing, and engineering, a black box is a device, system or object which can be viewed in terms of its inputs and outputs (or transfer characteristics), without any knowledge of its internal workings. Its implementation is “opaque” (black). Almost anything might be referred to as a black box: a transistor, algorithm, or the human brain.

The opposite of a black box is a system where the inner components or logic are available for inspection, which is most commonly referred to as a white box (sometimes also known as a “clear box” or a “glass box”).

───

□ □ 『性質』與 ○ ○『內涵』隨意假設。最好本著

知之為知之,不知為不知

的精神,『如實』的探索這些『箱子』的『功能』以及其『出入』之連接『方式』,如是或可避免某些『誤解』的吧!無須發生

……

─── 摘自《勇闖新世界︰ W!o《卡夫卡村》變形祭︰品味科學‧教具教材‧【專題】 PD‧箱子世界‧出入

 

因為『小樹林系統』韌體的核心是 Arduino ,所以必須深入了解 Arduino 中的︰

Digital Pins

The pins on the Arduino can be configured as either inputs or outputs. This document explains the functioning of the pins in those modes. While the title of this document refers to digital pins, it is important to note that vast majority of Arduino (Atmega) analog pins, may be configured, and used, in exactly the same manner as digital pins.

───

digitalRead()

Description

Reads the value from a specified digital pin, either HIGH or LOW.

Syntax

digitalRead(pin)

Parameters

pin: the number of the digital pin you want to read (int)

Returns

HIGH or LOW

───

digitalWrite()

Description

Write a HIGH or a LOW value to a digital pin.

If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.

If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor. See the digital pins tutorial for more information.

NOTE: If you do not set the pinMode() to OUTPUT, and connect an LED to a pin, when calling digitalWrite(HIGH), the LED may appear dim. Without explicitly setting pinMode(), digitalWrite() will have enabled the internal pull-up resistor, which acts like a large current-limiting resistor.

Syntax

digitalWrite(pin, value)

Parameters

pin: the pin number

value: HIGH or LOW

Returns

none

─────

Analog Input Pins

A description of the analog input pins on an Arduino chip (Atmega8, Atmega168, Atmega328, or Atmega1280).

A/D converter

The Atmega controllers used for the Arduino contain an onboard 6 channel analog-to-digital (A/D) converter. The converter has 10 bit resolution, returning integers from 0 to 1023. While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of general purpose input/output (GPIO) pins (the same as digital pins 0 – 13).

Consequently, if a user needs more general purpose input output pins, and all the analog pins are not in use, the analog pins may be used for GPIO.

───

analogRead()

Description

Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range and resolution can be changed using analogReference().

It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.

Syntax

analogRead(pin)

Parameters

pin: the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)

Returns

int (0 to 1023)

Note

If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.).

───

analogWrite()

Description

Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite() on the same pin). The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz. Pins 3 and 11 on the Leonardo also run at 980 Hz.

On most Arduino boards (those with the ATmega168 or ATmega328), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 – 13 and 44 – 46. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.

The Arduino Due supports analogWrite() on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DAC0 and DAC1 are Digital to Analog converters, and act as true analog outputs.

You do not need to call pinMode() to set the pin as an output before calling analogWrite().

The analogWrite function has nothing to do with the analog pins or the analogRead function.

Syntax

analogWrite(pin, value)

Parameters

pin: the pin to write to.

value: the duty cycle: between 0 (always off) and 255 (always on).

Returns

nothing

Notes and Known Issues

The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g 0 – 10) and may result in a value of 0 not fully turning off the output on pins 5 and 6.

───

 

概念、功能、以及運用方法。對於任何不清楚的『術語』,比方說

PWM

The Fading example demonstrates the use of analog output (PWM) to fade an LED. It is available in the File->Sketchbook->Examples->Analog menu of the Arduino software.

Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of “on time” is called the pulse width. To get varying analog values, you change, or modulate, that pulse width. If you repeat this on-off pattern fast enough with an LED for example, the result is as if the signal is a steady voltage between 0 and 5v controlling the brightness of the LED.

In the graphic below, the green lines represent a regular time period. This duration or period is the inverse of the PWM frequency. In other words, with Arduino’s PWM frequency at about 500Hz, the green lines would measure 2 milliseconds each. A call to analogWrite() is on a scale of 0 – 255, such that analogWrite(255) requests a 100% duty cycle (always on), and analogWrite(127) is a 50% duty cycle (on half the time) for example.

───

 

 ,務須努力探究明白︰

脈衝寬度調變

脈衝寬度調變英語:Pulse Width Modulation縮寫PWM) ,簡稱脈寬調製,是將類比信號 轉換為脈波的一種技術,一般轉換後脈波的週期固定,但脈波的占空比會依類比信號的大小而改變。

在類比電路中,類比信號的值可以連續進行變化,在時間和值的幅度上都幾乎沒有限制,基本上可以取任何實數值,輸入與輸出也呈線性變化。所以在類比電路中,電壓和電流可直接用來進行控制對象,例如家用電器設備中的音量開關控制、採用鹵素燈泡燈具的亮度控制等等。

但類比電路有諸多的問題:例如控制信號容易隨時間漂移,難以調節;功耗大;易受雜訊和環境干擾等等。

與類比電路不同,數位電路是在預先確定的範圍內取值,在任何時刻,其輸出只可能為ON和OFF兩種狀態,所以電壓或電流會通/斷方式的重複脈衝序列加載到類比負載。PWM技術是一種對類比信號電位的數字編碼方法,通過使用高解析度計數器(調製頻率)調製方波占空比,從而實現對一個類比信號的電位進行編碼。其最大的優點是從處理器到被控對象之間的所有信號都是數位形式的,無需再進行數位類比轉換過程;而且對雜訊的抗干擾能力也大大增強(雜訊只有在強到足以將邏輯值改變時,才可能對數位訊號產生實質的影響),這也是PWM在通訊等信號傳輸行業得到大量應用的主要原因。

類比信號能否使用PWM進行編碼調製,僅依賴帶寬,這即意味著只要有足夠的帶寬,任何類比信號值均可以採用PWM技術進行調製編碼,一般而言,負載需要的調製頻率要高於10Hz,在實際應用中,頻率約在1kHz到200kHz之間。

在信號接收端,需將信號解調還原為類比信號,目前在很多微型處理器內部都包含有PWM控制器模組。

350px-PWM,_3-level.svg

一個例子脈寬調製:供電電壓(藍色)調製為一系列的脈衝產生一個正弦樣磁通密度波形(紅色),在磁路的電磁致動器。平滑的波形由此可以控制的寬度和數目的脈衝調製(每特定週期)

───

Principle

 

Fig. 1: a pulse wave, showing the definitions of y_\text{min}, y_\text{max} and D.

Pulse-width modulation uses a rectangular pulse wave whose pulse width is modulated resulting in the variation of the average value of the waveform. If we consider a pulse waveform f(t), with period T, low value y_\text{min}, a high value y_\text{max} and a duty cycle D (see figure 1), the average value of the waveform is given by:

\bar{y} = \frac{1}{T}\int^T_0f(t)\,dt.

As f(t) is a pulse wave, its value is y_\text{max} for 0 < t < D \cdot T and y_\text{min} for D \cdot T < t < T. The above expression then becomes:

This latter expression can be fairly simplified in many cases where y_\text{min} = 0 as \bar{y} = D \cdot y_\text{max}. From this, it is obvious that the average value of the signal (\bar{y}) is directly dependent on the duty cycle D.

───

Three Ways To Read A PWM Signal With Arduino

PWM (Pulse-Width Modulation) is a modulation technique that controls the width of the pulse based on modulator signal information. PWM can be used to encode information for transmission or to control of the power supplied to electrical devices such as motors.

Generating a PWM signal with an Arduino is quite easy. There is significantly less documentation on how best to read a PWM signal. I needed to read the receiver signals for a remote controlled Quadcopter and after doing some research, I discovered three methods of reading a PWM signal with an Arduino.

───

 

能夠貫通不同的說法︰

碼 習 。兩根母母線,以一千導阻,井通二四與二六 ,古曰︰西金北水關。用二、二十、二百赫茲均任脈衝發西金,以取北水之數論證,訊通此關之法。

☿ 答︰『西金』數四、九,既『發』當是『出針』;『北水』一與六,以『取』故為『入針』。『均任』者,平責, duty cycle = dc = 50。『脈衝』者, PWM 也。以『數』『證』之者,證『發數』和『取數』相符。『二』、『二十』、『二百』皆『赫茲』者, Hz 也,全是 PWM 之 frequency 。然而『連續』之『訊號』,考之以『離散』之『讀取』,或可『實證』者,僅『 1 』以及『 0 』平均一周期之『比例』而已。故而『訊通此關之法』之要,在於越能『高速』取值越相合。

行 ︰每每都用母母線!?不知是『母』好用!還是怕我們『不知』用『公』?!☿☺☺

欲程式『實證』理論,昨兒乏了,何不改日?…… ☺☿

訊 ︰☿ 《古訓》︰井中有仁,切勿落井下石。

─── 摘自《M♪o 之學習筆記本《寅》井井

 

當然最好『學而時習之』,入

亨,出入无疾,朋來无咎,反復其道,七日來復,利有攸往。

之康莊大道也。

 

 

 

 

 

 

 

 

 

 

 

W!o+ 的《小伶鼬工坊演義》︰小樹林系統之速描

人類發現『規律』的天性,使得人世間總有一些不傳的『技藝』。這一些未經『科學』解釋之『經驗』,正是理性『思辨』的『種子 』 !若非冥冥中自有『系統』、『環境』、『法則』 …… 等等促成之『作用』,那一種『經驗』又怎可能的呢?於是『思辨』不得不落入『無可思議』的乎!!

一般默念或念出聲音

一般閱讀方式──念出聲或默念

眼腦直映

速讀──眼腦直映

Eye-exercise-for-speed-reading_thumb

速讀的眼睛訓練

有人說人可以『速讀』的也??維基百科詞條講︰

速讀

速讀是快速而有效的閱讀,是一種在不影響理解記憶的情況下,提升閱讀速率的閱讀方法。用到的方法常包括有各種心理學技巧,如組塊化(chunking)、去除默讀(subvocalization)等。 其中速讀的原理有兩個:擴大視野眼腦直映

  1. 擴大視野藉由視野的擴大,眼睛可閱讀的字數增加,當然速度自然倍數成長。

     

    擴大視野練習

  2. 眼腦直映是一種眼睛看到,頭腦直接反應的一種直覺化反應的過程。

那麼這樣的『如人飲水』之事!!到底是人人有之『共性』或者說『殊性 』之論的耶??即使從其始初

起源

速讀起源[1]第二次世界大戰時, 美國國防部為使軍官能有效且迅速地判斷空中快速行進的戰機標誌和各式型體,發明速視儀裝置,快速閃示視覺刺激,藉由閃示訓練,軍官可以在1/500秒內辨 別極小的飛機圖像。閱讀學家的後續研究發現受過訓練的普通人平均可在一分鐘內閱讀2萬個英文單字,未受過訓練的人平均可閱讀200個單字,可見人類在閱讀 上具有相當大的潛力。 戰後美國西北大學視聽教育中心繼續研究速讀方法,哈佛大學首先開辦第一期速讀訓練班,而後速讀訓練班在各地大、中小學校普及,至今美國80%以上的高等院 校都開設有速讀課程,且有專門研究和教授速讀的速讀學院,可授予學習者博士學位。1964年速讀傳入台灣逐漸推廣。

 

以及歸結

原理

一般人看書時是:「眼睛看」→「嘴巴念或默念」→「頭腦想與記憶」。 嘴巴念或默念是使閱讀速度無法大量增進的主因之一。眼睛視線所及常是一個面而非一個點,如看風景、照片、電影等圖像時,人能看到整個畫面,並不需要從上到 下或從左到右依序地看,也不用嘴巴念或默念。速讀的原理便在於改變原本一行一行逐字念出或默念的習慣,養成「眼睛看」→「頭腦想與記憶」的閱讀習慣(眼腦 直映),則看書可一眼看一行以上,或將多行文字以形成一個畫面的方式,看整個頁面。[2]

 

來講,任何一個複雜系統的『表面行為』與其『內在機制』之關係可能也是『複雜』的吧!更不要說任『一個人』還可以『學習』、『改變』、 …… 增益『其所不能』的矣!!

若問『速描』一張『圖像』,用著『來不及想』那樣的速度,其所『反映』的『本徵』要點,是屬於『描者』,還是屬於『被描者』 、或是屬於『描』與『被描』所構成的『系統』耶???假使以『量子』量測來看,大概得是『系統』的吧!!!如果用『經典』力學觀察,可能『最大機率』依舊是『被描者』的哩???

如是說來,假使『小樹林系統』是人自己『 Top Down 』從上往下用人之『邏輯』建構的『人為系統』。那麼擁有『生命』與『智慧 』的『自然系統』,是否可以『判定 』其是來自『上→下』,還是『下→上』,或是『上↑↓下』的嗎?

最近 Adafruit 部落格上有篇文章講

How Do We Know What Air is Like on Other Planets?

#SaturdayMorningCartoons

How Do We Know What Air is Like on Other Planets? via MinutePhysics

How do we know what the air is like on planets we haven’t visited?

This video explains how to see air from 150 light years away.

Read more

 

。雖說的斬釘截鐵篤定萬分,但思如果地球上的科學家都不能一致同意『氣候變遷』的現象,那麼他們可能一致都同意那個的耶??如果從不同『學科分支』來看『自然』,或許人會發現︰自然未必『精簡』,自然未必『省時』、自然未必『省力』,自然未必符合『剃刀原理』???一切終究還是『人以為』的吧!!!

因此細想︰

事實上『軟體工程』的歷史很短,假使從一九六八年『克努斯』的《電腦程式設計藝術》 The Art of Computer Programming 算起, 也還不到半個世紀,尚不要說『藝術』一詞所指的『意義』是什麼呢?因而□□『軟體標準化』 Software standard 大概還是某些○○『系統平台』 Computing platform 圈內的事。這樣難道不好嗎?如果用『螺絲釘』與『螺絲帽』來比喻,有人說軟體『工程化』的好處就是彼此間說『同一國的語言』,因此『協作容易』。作者認為自然中豐富之『多樣性』,正是『生態平衡』的大道;地球上不同的『方言』,產生『社會文化』的消長,所以無須強求一致的吧!然而這或許就得面對『甲軟體』和『乙軟體No Talking 的問題的了?!

那麼我們將要怎麽了解《 Remotely running Python-based graphics on a connected screen 》所講的 ssh 需要 『 sodu ☆☆ 』的問題呢?假使你已經『嘗試』過了各種『作法』,最後也正如那文本所說,發現只要冠上了『 sudo 』果真就可以,這樣我們是否就能作成『結論』呢?在眼前的這一個『問題』就是『使用者』之『權限』所引發的『麻煩』!有一天『偶然的』我們讀到一篇《 Segfault when I use SDL via ssh as pi user 》議論,然後開始『懷疑』真的是這樣的嗎?之後又讀到《 Displaying content/info on TFT display over SSH 》說法,於是產生『煩惱』果真的是這樣的嗎??也許講,本來事物的『複雜性』並不會引起『疑慮』,硬要將它『簡單化』可就『困擾』多多的嘍!!

250px-0726_La_Canée_musée_linéaire_A
線形文字A

250px-NAMA_Linear_B_tablet_of_Pylos
線形文字B

線形文字 A 是種在古代克里特島上使用,尚未破解文字。它的解譯會是考古學上的『聖杯』。其一種關聯文字,線形文字 B 於一九五零年被 Michael Ventris 破譯,證明它為希臘語的一種古代形式。

如果把不能『簡單化』的『疑難』強迫簡化,也許只是『過度化』的吧!奥卡姆的『剃刀原理』去除『多餘的假設』,就像『歸謬證法』排除『邏輯之矛盾』一樣,難到『科學』果能有『神奇』之『其他辦法』的嗎??假使『科學精神』是建立在人人可得之『事實』,大家可以『實驗』驗證的基礎上,所謂的『科學假設』或許是喜歡被打敗的事吧!於是愛因斯坦設想『光速不變』,真的是宛如『燃素說』一般的嗎?當然不是,邏輯上講,要是 A + New \ Theory \Longrightarrow \approx \ Old \ Theory,那麼要『 A 』又有何用?因是之故,『科學假設SA 通常是說, SA + New \ Theory \Longrightarrow \neq Old \ Theory ,因此才可以判定『是非對錯』的吧!!

300px-Longleat_maze

220px-Minotauros_Myron_NAMA_1664_n1

Maze01-02

怎麽『』迷宮,『』出路的呢?大數學家『尤拉』是第一位使用平面連通之『分析方法』來解決『迷途』 Maze 的人,後來此種研究『方式』被稱之為『拓撲學』。依據『右 手定律』,或者對等的說就是『左手定則』,這就是著名的『迷宮演算法』︰

如果那個迷宮是由簡單的路徑連接起來,也就是說,要是所有牆壁都是連接著的,這樣只要用右手指延著入口之某一堵 牆,如斯的前進,那將肯定不會迷路,並且可能尋着出口,也許最壞的打算祇是回到原點

假使按造『尤拉』的解法,即使是『迷宮般的軟體』,也都有『方法可循』,只要堅持到底,總有找到答案的一天。或許有人認為那作法『太慢』了『不好』,但是『』也得要能『解決』問題吧!否則『』又有什麼用呢?

那麼這個回覆
However, if you’re running graphical SDL apps on the framebuffer as a normal user via ssh, take into account how SDL framebuffer choses the active console and keyboard: take a look at src/video/fbcon/SDL_fbevents.c, around line 263 where it tests it you’re root or a normal user. Only the root path works via ssh… tell me if you manage to fix it.  

,是這個問題

Traceback (most recent call last):
  File "pygametest.py", line 14, in &lt;module&gt;
    DISPLAYSURF = pygame.display.set_mode((480, 320), 0, 32)
pygame.error: Unable to open a console terminal

的答案嗎??

─── 摘自《音樂播放器之 CD 轉成 mp3《三》下‧下

 

或許是有益的吧??!!

如此我們也可以了解『小樹林系統』之理念初衷︰

GlovePi+

 

適當地統整『Digital』、『Analog』、『I2C』、『UART』、……種種『感測器』物理『界面』,使得學習者能以少御多,通一全通的也。

所以幾個派生之『function』函式

# Line 190
# Arduino Digital Read
def digitalRead(pin):

# Arduino Digital Write
def digitalWrite(pin, value):

# Setting Up Pin mode on Arduino
def pinMode(pin, mode):

# Read analog value from Pin
def analogRead(pin):

# Write PWM
def analogWrite(pin, value):

 

果是『大哉用』的了??!!

就讓我們舉個例子來說︰現今『空氣品質』一事,人很關切,假使已有『感測器』說明︰

Grove – Air Quality Sensor

This sensor is designed for comprehensive monitor over indoor air condition. It’s responsive to a wide scope of harmful gases, as carbon monoxide, alcohol, acetone, thinner, formaldehyde and so on. Due to the measuring mechanism, this sensor can not output specific data to describe target gases’ concentrations quantitatively. But it’s still competent enough to be used in applications that require only qualitative results, like auto refresher sprayers and auto air cycling systems.

 

以及『範例』程式︰

import time
import grovepi

# Connect the Grove Air Quality Sensor to analog port A0
# SIG,NC,VCC,GND

# 感測器之『入出埠』
air_sensor = 0

# 此『感測器』是『輸入』
grovepi.pinMode(air_sensor,"INPUT")

while True:
    try:
        # Get sensor value
# 此『感測器』是『Analog』
        sensor_value = grovepi.analogRead(air_sensor)

        if sensor_value > 700:
            print "High pollution"
        elif sensor_value > 300:
            print "Low pollution"
        else:
            print "Air fresh"

        print "sensor_value =", sensor_value
        time.sleep(.5)

    except IOError:
        print "Error"

 

即使未曾使用過這種『感測器』,如果知道它屬於『小樹林系統』之『Analog』&『Input』類型之 Sensor ,難到我們真不能推論出『範例』重點的嘛☆★