lsb_release -a
執行結果範例:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 15.04 Release: 15.04 Codename: vivid
lsb_release -a
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 15.04 Release: 15.04 Codename: vivid
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa sudo apt-get update sudo apt-get install mosquitto sudo apt-get install mosquitto-clients
mosquitto_sub -d -t hello/world視窗暫時不要關閉
sudo apt-get update sudo apt-get install build-essential python-dev git clone https://github.com/adafruit/Adafruit_Python_DHT.git cd Adafruit_Python_DHT sudo python setup.py install
cd examples sudo ./AdafruitDHT.py 11 2執行結果:
Temp=25.0* Humidity=48.0%
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key cd /etc/apt/sources.list.d/接著視 Pi 作業系統版本而定
sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list或
sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list
sudo apt-get update sudo apt-get install mosquitto sudo apt-get install mosquitto-clients
mosquitto_sub -h 192.168.0.xx -d -t hello/world
mosquitto_pub -h 192.168.0.xx -d -t hello/world -m "`/root/AdafruitDHT.py 11 2`"
Client mosqsub/30610-myUbuntu received PINGRESP Client mosqsub/30610-myUbuntu received PUBLISH (d0, q0, r0, m0, 'hello/world', ... (26 bytes)) Temp=25.0* Humidity=48.0%