Page 3 of 3

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)?

Posted: Fri Oct 04, 2019 9:39 am
by salvato
mainwindow.h

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)?

Posted: Fri Oct 04, 2019 9:44 am
by dsyleixa123
ah, yes :)
did you add the line
int pin23, pin24;
in the class manually beneath "private" or has that been added automatically by the designer?

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)?

Posted: Fri Oct 04, 2019 10:40 am
by salvato
manually

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)? [solved]

Posted: Mon Oct 14, 2019 12:42 pm
by crs
Hello.
I want to use the GPIO from Raspberry Pi3 using Boot2qt. The issue it's that the modifies from *.pro and *.cpp file it's not enough for the compiler. Do you have idea how I can insert library in Raspberry using Boot2qt or what I do wrong?

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)? [solved]

Posted: Mon Oct 14, 2019 1:56 pm
by dsyleixa123
I personally do not know, I am happy that wiringPi works, with it's simplicity 8)

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)? [solved]

Posted: Mon Oct 14, 2019 2:41 pm
by crs
But what it's your configuration? You download the library and use QT Creator direct on Raspberry?

Re: qtcreator (qt5, qtdesigner): how to access GPIOs (r/w pins, i2c devices, UART,...)? [solved]

Posted: Mon Oct 14, 2019 2:45 pm
by dsyleixa123
yes, my installation was basically the following, quoted from several posts from here (for Raspbian Stretch):

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo apt-get autoremove
	
sudo apt install qtcreator 
sudo apt install gnustep gnustep-devel clang-3.8-doc llvm-3.8-doc qtbase5-dev cmake  kdelibs5-data subversion
sudo apt install qt5-default 

#optional:
sudo apt install qt5-qmltooling-plugins qt5-doc
sudo apt install qtdeclarative5-dev
sudo apt install libqt5multimedia5-plugins

Open Qtcreator and go to Help > about plugins and and untick Remote Linux

gpu memory: in  /boot/config.txt: gpu_mem=128  # 128MB

sudo reboot

Open Qt creator, 
go to "Tools > Options > Build and Run" (Extras->Einstellungen->Erstellen)  and go to Compilers. 
Add 
C: GCC,  compiler path= /usr/bin/gcc  
C++: GCC,  compiler Path=/usr/bin/g++
 
Then go to Kits and check whether Compiler, Debugger and Qt version are set;
choose qt Kit (drop down menu) additionally.

That's it , click Ok and create a new project

 

Adding wiringPi GPIO libs:

a) in .pro file add the 3 lines:
INCLUDEPATH += /usr/local/include
LIBS += -L"/usr/local/lib"
LIBS += -lwiringPi
b) additionally in  sourcecode of mainwindow.cpp: 
#include <wiringPi.h>