QT5 Use wiringpi i2c lcd example Pls
Hi, in designer Button display Status LED But i want to display Lcd 16x2 + i2c
command sudo i2cdetect -y 1
address 0x27
and include not error
#include "wiringPiI2C.h"
#include "wiringPi.h"
wiringPisetup();
wiringPiI2CSetup(27);
LcdDisplay("Test",0);
after run not Display to Lcd
Help Me Pls
Re: QT5 Use wiringpi i2c lcd example Pls
There is not nearly enough code to understand what you are doing.
E.g. there is no indication what "LcdDisplay" is, whether this has anything to do with Qt at all, if you created and started the Qt applicaition object if it is, etc.
Cheers,
_
1 Attachment(s)
Re: QT5 Use wiringpi i2c lcd example Pls
Quote:
Originally Posted by
anda_skoa
There is not nearly enough code to understand what you are doing.
E.g. there is no indication what "LcdDisplay" is, whether this has anything to do with Qt at all, if you created and started the Qt applicaition object if it is, etc.
Cheers,
_
i want display data to LCD 16x2
Attachment 12209
Re: QT5 Use wiringpi i2c lcd example Pls
Ok, so nothing to do with Qt.
Moving to a better section.
Cheers,
_
Re: QT5 Use wiringpi i2c lcd example Pls
Quote:
Originally Posted by
anda_skoa
Ok, so nothing to do with Qt.
Moving to a better section.
Cheers,
_
Final Code QT5
Connect I2C(PCF8574) + LCD Char 16x2
Show Text After Key in
On Off Blacklight
Code:
#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();
}
Re: QT5 Use wiringpi i2c lcd example Pls
And what do you get vs. what did you expect to get?
Have you done any error checking?
E.g. shouldn't you call wiringPiSetup() before calling any of the other functions from that library?
Have you checked that lcdInit() works when called before that?
Cheers,
_