15,895,011 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by boonC (Top 4 by date)
boonC
17-Mar-20 3:34am
View
even you say google, google cannot help so much. google cannot give you any related solution. if the google have solution, i won't had write a forum get some advise or help from others.
boonC
13-Mar-20 3:59am
View
Deleted
i tried to add gtk_label_set_text and g_timeout_add_second(). but i still stuck that my reading does not able update by itself, you need to reopen it to get it new value. this is my current code that i made. could you help me to corrected it if i had put something wrong.
#include <wiringpi.h>
#include <sys types.h="">
#include <sys stat.h="">
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <gtk gtk.h="">
#include <string.h>
#include <glib.h>
#define BUFSIZE 128
// typedef unsigned char uchar;
// typedef unsigned int uint;
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-0314979400b5/w1_slave", O_RDONLY);
if(-1 == fd){
perror("open device file error");
return 1;
}
while(1){
ret = read(fd, buf, BUFSIZE);
if(0 == ret){
break;
}
if(-1 == ret){
if(errno == EINTR){
continue;
}
perror("read()");
close(fd);
return 1;
}
}
for(i=0;i
boonC
11-Mar-20 7:00am
View
may i ask if printf show variable reading value, is it possible to transfer the printf reading to inside gtk, how i compile the code using c-language?
boonC
11-Mar-20 6:22am
View
i mean is the sensor is already connect to raspberry pi, when i open the created gtk, it will show the temperature value and its value will automatically update per second according the sensor detect.