#include "mainwindow.h"
#include <QApplication>
#include <QWidget>
#include <QtCore>
#include <QtGui>
#include <QMessageBox>
#include "ui_mainwindow.h"
#include <wiringPi.h>
#include <pcf8574.h>
#include <lcd.h>
#define LCDOFS(x)(lcdofs+x)
const int lcdofs=0x64;
const int fd=lcdInit(2,16,4,LCDOFS(0),LCDOFS(2),LCDOFS(4),LCDOFS(5),LCDOFS(6),LCDOFS(7),0,0,0,0);
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
pcf8574Setup(lcdofs,0x3f);
wiringPiSetup();
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
str =ui->lineEdit->text();
pinMode(LCDOFS(1),OUTPUT);
pinMode(LCDOFS(3),OUTPUT);
digitalWrite(LCDOFS(1),0);// 0=Character New Lcd ;1= Character Not New
digitalWrite(LCDOFS(3),1);// 0=off;1=on Backlight off
lcdHome(fd);
lcdClear(fd);
lcdPosition(fd,0,0);
lcdPrintf(fd,ui->lineEdit->text().toUtf8());
lcdPosition(fd,0,1);
lcdPrintf(fd,ui->lineEdit_2->text().toUtf8());
// digitalWrite(LCDOFS(1),1);//
msgbox.setWindowTitle("Message Box");
msgbox.setText(str);
msgbox.exec();
}
#include "mainwindow.h"
#include <QApplication>
#include <QWidget>
#include <QtCore>
#include <QtGui>
#include <QMessageBox>
#include "ui_mainwindow.h"
#include <wiringPi.h>
#include <pcf8574.h>
#include <lcd.h>
#define LCDOFS(x)(lcdofs+x)
const int lcdofs=0x64;
const int fd=lcdInit(2,16,4,LCDOFS(0),LCDOFS(2),LCDOFS(4),LCDOFS(5),LCDOFS(6),LCDOFS(7),0,0,0,0);
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
pcf8574Setup(lcdofs,0x3f);
wiringPiSetup();
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString str;
str =ui->lineEdit->text();
pinMode(LCDOFS(1),OUTPUT);
pinMode(LCDOFS(3),OUTPUT);
digitalWrite(LCDOFS(1),0);// 0=Character New Lcd ;1= Character Not New
digitalWrite(LCDOFS(3),1);// 0=off;1=on Backlight off
lcdHome(fd);
lcdClear(fd);
lcdPosition(fd,0,0);
lcdPrintf(fd,ui->lineEdit->text().toUtf8());
lcdPosition(fd,0,1);
lcdPrintf(fd,ui->lineEdit_2->text().toUtf8());
// digitalWrite(LCDOFS(1),1);//
QMessageBox msgbox;
msgbox.setWindowTitle("Message Box");
msgbox.setText(str);
msgbox.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks