Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more. Accepting essential orders - here's how.
0

How Adafruit_BBIO Library can be integrated in Qt Creator?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How Adafruit_BBIO Library can be integrated in Qt Creator?

by geron on Thu Jul 07, 2016 7:24 pm

I`m trying to use Adafruit_BBIO Library into Qt Creator , but Qt Creator can not recognize the Library.


#-------------------------------------------------
#
# Project created by QtCreator 2016-06-21T20:15:43
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = Example_Beaglebone_Black_Switch
TEMPLATE = app


SOURCES += main.cpp\
mainwindow.cpp

HEADERS += mainwindow.h

FORMS += mainwindow.ui


unix:!macx: LIBS += -L$$PWD/../../../usr/local/lib/python2.7/dist-packages/Adafruit_BBIO/ -lGPIO

INCLUDEPATH += $$PWD/../../../usr/local/lib/python2.7/dist-packages/Adafruit_BBIO
DEPENDPATH += $$PWD/../../../usr/local/lib/python2.7/dist-packages/Adafruit_BBIO

INCLUDEPATH += gcc -c -I/usr/include/python2.7 sourcefile.c



unix: PKGCONFIG += python2.7

I get some errors when I try to use GPIO .

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)

{
ui->setupUi(this);

import; "Adafruit_BBIO.GPIO as GPIO";
GPIO.setup("P8_10", GPIO.OUT);

The errors

/home/reyesj/Example_Beaglebone_Black_Switch/mainwindow.cpp:12: error: 'import' was not declared in this scope
import; "Adafruit_BBIO.GPIO as GPIO";
^
/home/reyesj/Example_Beaglebone_Black_Switch/mainwindow.cpp:12: warning: statement has no effect [-Wunused-value]
import; "Adafruit_BBIO.GPIO as GPIO";
^
/home/reyesj/Example_Beaglebone_Black_Switch/mainwindow.cpp:13: error: 'GPIO' was not declared in this scope
GPIO.setup("P8_10", GPIO.OUT);
^
Regards

geron
 
Posts: 2
Joined: Thu Jul 07, 2016 7:09 pm

Re: How Adafruit_BBIO Library can be integrated in Qt Creato

by drewfustini on Fri Jul 08, 2016 2:19 pm

Adafruit_BBIO is a Python library so I don't think it would be compatible for Qt Creator which I believe is for C++.

You could use Adafruit_BBIO with PyQt potentially:
https://wiki.python.org/moin/PyQt

I did use PyQt on the BeagleBone a few years ago:
https://www.element14.com/community/com ... -python-qt

If you want to stick to C or C++, then you might want to look at:

libsoc: C library for interfacing with common SoC peripherals through generic kernel interfaces
https://github.com/jackmitch/libsoc

mraa: Low Level Skeleton Library for IO Communication on GNU/Linux platforms
https://github.com/intel-iot-devkit/mraa
Last edited by drewfustini on Fri Jul 08, 2016 5:14 pm, edited 1 time in total.

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Re: How Adafruit_BBIO Library can be integrated in Qt Creato

by geron on Fri Jul 08, 2016 3:06 pm

Thanks a lot for your answer.

Now is clear for me , Adafruit_BBIO is not compatible with Qt Creator.

I will try to use PyQt .

geron
 
Posts: 2
Joined: Thu Jul 07, 2016 7:09 pm

Please be positive and constructive with your questions and comments.