xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 23KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-10
  • 語言: 其他
  • 標簽: DS18B20??QT??

資源簡介

實現DS18B20的測溫實現,基于linux內核版本的,有QT界面,代碼簡潔已讀,魯棒性還行。PS:該程序為應用程序,非驅動程序!

資源截圖

代碼片段和文件信息

#include?“lcd.h“
#include?
#include?

#include?
#include?
#include?
#include?
#include
#include
#include

MyMainWindow::MyMainWindow()
{
????????????????setGeometry(00320240);

label1?=?new?QLabel(this);
label1?->?setGeometry(101030050);
label1?->?setText(“DS18B20?TEST“);
label1?->?setFont(QFont(“times“18QFont::Bold));
label1?->?setAlignment(Qt::AlignCenter);

label2?=?new?QLabel(this);
label2?->?setText(“Temperature?is“);
label2?->?setFixedSize(16080);
label2?->?setFont(QFont(“Courier“10QFont::Light));
label2?->?setAlignment(Qt::AlignCenter|Qt::AlignLeft);

label3?=?new?QLabel(this);
label3?->?setText(“‘C“);
label3?->?setFont(QFont(“Courier“10QFont::Light));
label3?->?setAlignment(Qt::AlignCenter|Qt::AlignRight);

start?=?new?QPushButton(“start“this);
start?->?setMinimumSize(5040);
start?->?setFont(QFont(“times“15QFont::Bold));

stop?=?new?QPushButton(“stop“this);
stop?->?setMinimumSize(5040);
stop?->?setFont(QFont(“times“15QFont::Bold));

????????????????lcdnum?=?new?QLCDNumber(this);
lcdnum?->?setFixedSize(10080);//固定大小
lcdnum?->?setSmallDecimalPoint(true);//顯示一位小數
lcdnum?->?setNumDigits(4);
lcdnum?->?setSegmentstyle(QLCDNumber::Filled);
QPalette?lcdp?=?lcdnum?->?palette();
lcdp.setColor(QPalette::NormalQPalette::WindowTextQt::black);//前景色為黑色
lcdnum?->?setPalette(lcdp);

QVBoxLayout?*vbox?=?new?QVBoxLayout(this);
QHBoxLayout?*hbox1?=?new?QHBoxLayout();
QHBoxLayout?*hbox2?=?new?QHBoxLayout();
QHBoxLayout?*hbox3?=?new?QHBoxLayout();

vbox?->?addLayout(hbox1);
vbox?->?addLayout(hbox2);
vbox?->?addLayout(hbox3);

hbox1?->?addWidget(label1);

hbox2?->?addWidget(label2);
hbox2?->?addWidget(lcdnum);
hbox2?->?addWidget(label3);

hbox3?->?addWidget(start);
hbox3?->?addWidget(stop);

timer?=?new?QTimer(this);

connect(startSIGNAL(clicked())thisSLOT(start_time()));
connect(timerSIGNAL(timeout())thisSLOT(get_tmp()));
connect(stopSIGNAL(clicked())thisSLOT(stop_tmp()));
}

void?MyMainWindow::start_time()
{
timer?->?start(1000);
}

void?MyMainWindow::get_tmp()
{
stop?->?setEnabled(true);
start?->?setEnabled(false);
fd?=?open(“/dev/TX2440-ds18b20“?0);
if?(fd? {
perror(“open?device?ds18b20“);
exit(1);
}
ret?=?read(fd&data4);
if(ret<0)
printf(“read?ds18b20?error\n“);
printf(“read?ds18b20\n“);
temp?=?data?*?0.0625;
temp1=?(int)(temp?*?10?+?0.5);
z_s?=?temp1/10;
x_s?=?(float)(temp1%10);
wen_du?=?z_s?+?x_s/10;
printf(“Temperature?is??[%d.%d?‘C]\n“?temp1/10?temp1%10);
lcdnum?->?display(wen_du);
::close(fd);
}

void?MyMainWindow::stop_tmp()
{
stop?->?setEnabled(false);
start?-

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????35632??2010-05-06?15:37??ds18b20_time\ds18b20_time

?????文件????????313??2010-05-06?15:37??ds18b20_time\ds18b20_time.pro

?????文件???????3211??2010-05-06?15:36??ds18b20_time\lcd.cpp

?????文件????????683??2010-05-06?14:33??ds18b20_time\lcd.h

?????文件??????13948??2010-05-06?15:37??ds18b20_time\lcd.o

?????文件???????9319??2010-05-06?15:37??ds18b20_time\Makefile

?????文件???????2227??2010-05-06?14:47??ds18b20_time\moc_lcd.cpp

?????文件???????7536??2010-05-06?14:47??ds18b20_time\moc_lcd.o

?????文件??????21314??2011-10-27?13:39??ds18b20_time\ds18b20_time.pro.user

?????目錄??????????0??2010-05-06?15:41??ds18b20_time

-----------?---------??----------?-----??----

????????????????94183????????????????????10


評論

共有 條評論