dsyleixa123
Posts: 462
Joined: Mon Jun 11, 2018 11:22 am

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

Fri Oct 04, 2019 9:44 am

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?


crs
Posts: 3
Joined: Fri Oct 11, 2019 9:28 am

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

Mon Oct 14, 2019 12:42 pm

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?

dsyleixa123
Posts: 462
Joined: Mon Jun 11, 2018 11:22 am

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

Mon Oct 14, 2019 1:56 pm

I personally do not know, I am happy that wiringPi works, with it's simplicity 8)

crs
Posts: 3
Joined: Fri Oct 11, 2019 9:28 am

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

Mon Oct 14, 2019 2:41 pm

But what it's your configuration? You download the library and use QT Creator direct on Raspberry?

dsyleixa123
Posts: 462
Joined: Mon Jun 11, 2018 11:22 am

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

Mon Oct 14, 2019 2:45 pm

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>

Return to “C/C++”