From e43d8627735236c5e709197ec5c66fa1d79dfffe Mon Sep 17 00:00:00 2001 From: Tom Xue Date: Mon, 24 Nov 2014 00:17:11 +0800 Subject: [PATCH 1/6] fix a bug: QString has no function of toAscii() --- QtArduino/QtArduino.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/QtArduino/QtArduino.pro b/QtArduino/QtArduino.pro index 24f1d31..90c1184 100644 --- a/QtArduino/QtArduino.pro +++ b/QtArduino/QtArduino.pro @@ -19,3 +19,4 @@ SOURCES += main.cpp\ HEADERS += mainwindow.h FORMS += mainwindow.ui +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 From 1e3a3e94dabe257943cb047a0448ca352de27318 Mon Sep 17 00:00:00 2001 From: Tom Xue Date: Tue, 25 Nov 2014 01:12:21 +0800 Subject: [PATCH 2/6] tweak a little --- QtArduino/mainwindow.cpp | 4 +++- QtArduino/mainwindow.ui | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/QtArduino/mainwindow.cpp b/QtArduino/mainwindow.cpp index 78291c0..ea9a541 100644 --- a/QtArduino/mainwindow.cpp +++ b/QtArduino/mainwindow.cpp @@ -46,7 +46,9 @@ void MainWindow::onPacketReceived() else ui->leDigital->setStyleSheet("QLineEdit { background-color: none }"); - ui->barAnalog->setValue(analog); //slide the progress bar + ui->leDigital->setText("tom xue"); + + ui->barAnalog->setValue(33); //slide the progress bar } diff --git a/QtArduino/mainwindow.ui b/QtArduino/mainwindow.ui index 1793870..89f5617 100644 --- a/QtArduino/mainwindow.ui +++ b/QtArduino/mainwindow.ui @@ -44,7 +44,8 @@ - 1 + Adobe Arabic + 16 @@ -66,6 +67,33 @@ + + true + + + + 0 + 0 + + + + + 417 + 40 + + + + + 0 + 5 + + + + + 0 + 5 + + 255 @@ -92,7 +120,7 @@ 0 0 435 - 22 + 23 From 9104e60b989325c32aef7afcd74e419bc18bec64 Mon Sep 17 00:00:00 2001 From: "tomxue, tomxuetoy" Date: Tue, 25 Nov 2014 23:33:10 +0800 Subject: [PATCH 3/6] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3662188..a50ae79 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ QtArduino ========= -Basic Qt application and Arduino sketch used to teach others how to make them communicate over UDP. \ No newline at end of file +Basic Qt application and Arduino sketch used to teach others how to make them communicate over UDP. +Learn how to use Qt to make an Android UDP app. From 4c9b6daf9ebea30296bc6599b40b89bf5641cece Mon Sep 17 00:00:00 2001 From: "tomxue, tomxuetoy" Date: Tue, 25 Nov 2014 23:33:33 +0800 Subject: [PATCH 4/6] Rename README.md to README --- README.md => README | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => README (100%) diff --git a/README.md b/README similarity index 100% rename from README.md rename to README From b323d71242a57a709545a708b74484a1e5f8157b Mon Sep 17 00:00:00 2001 From: "tomxue, tomxuetoy" Date: Wed, 26 Nov 2014 00:07:45 +0800 Subject: [PATCH 5/6] Update README --- README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README b/README index a50ae79..3c132db 100644 --- a/README +++ b/README @@ -3,3 +3,7 @@ QtArduino Basic Qt application and Arduino sketch used to teach others how to make them communicate over UDP. Learn how to use Qt to make an Android UDP app. + +Setup: + (1) Tested work: Use a router as wifi AP, while a Android phone and SocketTool are as wifi station. + (2) Not work: Use Android phone as the wifi AP, and SocketTool cannot send/recv message from the phone. From d41daccb335d2bf0bdd5b3feda9af2077f862deb Mon Sep 17 00:00:00 2001 From: Tom Xue Date: Sat, 13 Dec 2014 18:29:53 +0800 Subject: [PATCH 6/6] updated --- QtArduino/mainwindow.cpp | 14 ++++++++++---- QtArduino/mainwindow.ui | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/QtArduino/mainwindow.cpp b/QtArduino/mainwindow.cpp index ea9a541..b30ac3b 100644 --- a/QtArduino/mainwindow.cpp +++ b/QtArduino/mainwindow.cpp @@ -1,5 +1,6 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -41,15 +42,20 @@ void MainWindow::onPacketReceived() stream >> digital >> analog; //parse the packet //Change the color of the QLineEdit - if(digital == 1) + if(digital%2 == 1) ui->leDigital->setStyleSheet("QLineEdit { background-color: rgb(136, 195, 240) }"); else ui->leDigital->setStyleSheet("QLineEdit { background-color: none }"); - ui->leDigital->setText("tom xue"); - - ui->barAnalog->setValue(33); //slide the progress bar + ui->leDigital->setText(QString::number(digital)); + if(digital <= 100) + ui->barAnalog->setValue(digital); //slide the progress bar + else + QMessageBox::critical(0 , + "critical message" , "The value received is bigger than 100?", + QMessageBox::Ok | QMessageBox::Default , + QMessageBox::Cancel | QMessageBox::Escape , 0 ); } void MainWindow::sendPacket() diff --git a/QtArduino/mainwindow.ui b/QtArduino/mainwindow.ui index 89f5617..bc97686 100644 --- a/QtArduino/mainwindow.ui +++ b/QtArduino/mainwindow.ui @@ -105,7 +105,7 @@ - 255 + 100 0