//tips
//Biz
猟銃読本。
コーヒー用水筒洗浄器具買い出し。
大平山登頂。生活にフィットする山なので
登山をルーチンに組み込む。
IOT制作
soil-moisture-sensorのappも作る必要があるとのこと。
mkdir soil-moisture-sensor
python3 -m venv .venv
source ./.venv/bin/activate
pip install CounterFit
pip install counterfit-connection
pip install counterfit-shims-grove
touch app.py
この後にsoil-moisture-sensorをブラウザのcounterfitに追加。
以前のcounterfitに追加する感じではなさそうなのでsoil-moisture-sensorアプリから
counterfitを開くことにする。
code .
print('Hello World!')
python app.py
counterfit
5000番は先の温度計・湿度計で使われていたので温度センサーのターミナルに行き、cpunterfitの稼働部分を削除。
再度トライ。
http://127.0.0.1:5000/
きちんと初期化が確認できた。
from counterfit_connection import CounterFitConnection
CounterFitConnection.init('127.0.0.1', 5000)
import time
from counterfit_shims_grove.adc import ADC
adc = ADC()
while True:
soil_moisture = adc.read(0)
print("Soil moisture:", soil_moisture)
time.sleep(3)
この後に
python app.py
ブラウザの値を読み取ってコンソールに表示。
Soil moisture: 0
きちんとrandom表示も機能させられた。
capacitance、静電容量は、コンデンサなどの絶縁された導体において、どのくらい電荷が蓄えられるかを表す量。
Iotデバイス(3V程度)で操作するのはrelay中継機で、中継機のon/offで本体の100v程度のエネルギーを持つマシンのアウトプットをコントロールする。これが基本の型になりそう。