User Manual
159
Find the function float tempRead(void), and the line "fd = open(XXXXXX)". Replace "28-
031467805ff" with your sensor address.
float tempRead(void)
{
float temp;
int i, j;
int fd;
int ret;
char buf[BUFSIZE];
char tempBuf[5];
fd = open("/sys/bus/w1/devices/28-031467805fff/w1_slave", O_RDONLY);
if(-1 == fd){
perror("open device file error");
return 1;
}
Save and exit.
Step 4: Compile
gcc temp_monitor.c -lwiringPi
Step 5: Run
sudo ./a.out
For Python users:
Step 2: Change directory
cd /home/pi/SunFounder_SensorKit_for_RPi2/Python/
Step 4: Run
sudo python 35_temp_monitor.py










