In the previous DS18B20 Digital Sensor Project, we have seen how to interface Arduino with DS18B20 and display the temperature on a 16X2 LCD Display. Change to this directory and create a new Python file with name ‘temperature.py’ using vim editor.In this file, type the following code and save the file.After writing or copying the code in to editor, save the file and you are ready to run the script. Any way to get this updated from original and all the comments and moved files for Raspberry Pi 3? For this purpose, I’ll be using the services of Dataplicity. 2 years ago
It is giving me this: gcc -O3 -Wall -I/usr/local/include,/usr/include/mysql -Winline -pipe -L/usr/local/lib,/usr/lib/arm-linux-gnueabihf -lmysqlclient -lpthread -lz -lm -lrt -ldl th.c -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt -o thth.c:13:20: warning: extra tokens at end of #include directive #include include include includeth.c:14:2: error: invalid preprocessing directive #< # include define RHT03_PIN 7 define CYCLETIME 60 time_t oldtime,newtime; // when did we last take a reading?th.c:36:18: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]th.c:37:3: warning: implicit declaration of function ‘wiringPiSetup’ [-Wimplicit-function-declaration]th.c:38:3: warning: implicit declaration of function ‘piHiPri’ [-Wimplicit-function-declaration]th.c:39:10: warning: missing terminating " character printf("rh.c rev 1.79 12/04/2013 WPNS %sCycle time: %i seconds, %i printf("rh.c rev 1.79 12/04/2013 WPNS %sCycle time: %i seconds, %i ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~th.c:40:1: error: ‘retries’ undeclared (first use in this function)th.c:40:1: note: each undeclared identifier is reported only once for each function it appears inth.c:40:10: warning: missing terminating " characterth.c:80:25: warning: missing terminating " character sprintf(SQLstring,"INSERT INTO TeplotaVlhkost sprintf(SQLstring,"INSERT INTO TeplotaVlhkost ^~~~~~~~~~~~~~~~~~~~~~~~~~~th.c:81:42: warning: missing terminating " character VALUES(unix_timestamp(now()),%5.1f,%5.1f)",(temp / 10.0),(rh / 10.0)); VALUES(unix_timestamp(now()),%5.1f,%5.1f)",(temp / 10.0),(rh / 10.0)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~th.c:90:1: error: expected declaration or statement at end of inputth.c:34:7: warning: unused variable ‘status’ [-Wunused-variable]th.c:33:15: warning: unused variable ‘timeinfo’ [-Wunused-variable]th.c:32:10: warning: unused variable ‘rawtime’ [-Wunused-variable]th.c:31:8: warning: unused variable ‘TimeString’ [-Wunused-variable]th.c:30:8: warning: unused variable ‘SQLstring’ [-Wunused-variable] char SQLstring[64]; // string to send to SQL engineth.c:28:18: warning: unused variable ‘newtime’ [-Wunused-variable] time_t oldtime,newtime; // when did we last take a reading?th.c:28:10: warning: variable ‘oldtime’ set but not used [-Wunused-but-set-variable] time_t oldtime,newtime; // when did we last take a reading?th.c:26:7: warning: variable ‘temp’ set but not used [-Wunused-but-set-variable] int temp, rh ; // temperature and relative humidity readings
Reply Select the Raspian distribution and install it.
Officially, the Raspberry Pi Foundation recommends that the temperature of your Raspberry Pi device should be below 85 degrees Celsius for it to work properly. Read it now. Since DS18B20 Sensor communicates only on 1-Wire Interface, we need to enable the same on Raspberry Pi. You have successfully completed your IoT based Temperature Monitor Application using Raspberry Pi, DS18B20 Temperature Sensor and Dataplicity.curl https://www.dataplicity.com/xxxxxxxx.py | sudo pythonDS18B20 Temperature Sensor with ESP8266 and ThingSpeakRaspberry Pi DHT11 Humidity and Temperature Sensor InterfaceRaspberry Pi Ultrasonic Sensor HC-SR04 Interface TutorialPIR Motion Sensor using Raspberry Pi | Interfacing Tutorial