EasyManua.ls Logo

ADEEPT Ultimate Sensor Kit for Raspberry Pi - Page 80

ADEEPT Ultimate Sensor Kit for Raspberry Pi
151 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The result is as follows:
root@rasberrypi:/sys/bus/w1/devices# ls
28-00000355d573 w1_bus_master1
28-00000355d573 is an external temperature sensor device, but it may vary with every
client. It is the serial number of your DS18b20.
Step 4: Check the current temperature
$ cd 28-00000355d573
$ ls
The result is as follows:
root@rasberrypi:/sys/bus/w1/devices/28-00000355d573# ls
driver id name power subsystem uevent w1_slave
$ cat w1_slave
The result is as follows:
root@raspberrypi:/sys/bus/w1_slave/28-00000495db35# cat w1_slave
a3 01 4b 46 7f ff 0d 10 ce : crc=ce YES
a3 01 4b 46 7f ff 0d 10 ce t=28154
The second line t=28154 is current temperature value. If you want to convert it to degree
Celsius, you can divide by 1000, that is, the current temperature is 28154/1000=28.154 ā„ƒ.
For C language users:
Step 5: Edit and save the code with vim or nano.
(code path: /home/Adeept_Sensor_Kit_for_RPi_C_Code/19_ds18b20/ds18b20_2.c.c)
Step 6: Compile
$ sudo gcc ds18b20_2.c -o ds18b20 -lwiringPi
Step 7: Run
$ sudo ./ds18b20
For Python users:
Step 5: Edit and save the code with vim or nano.
(code path: /home/Adeept_Sensor_Kit_for_RPi_Python_Code/19_ds18b20.py)
Step 6: Run
$ sudo python 19_ds18b20.py

Table of Contents