xwalter Posted May 29, 2016 Posted May 29, 2016 At the moment it seems that python library to manage the gpio is working well I'm trying with wiringPi with C++ under netbeans but it doesn't work . The compiler is the g++ and other parameters are ok ...I think But how to use this package with C/C++ ? In my project I include the #include <wiringPi.h> And netbeans compiles without any error, that's ok . But when I add this line of code wiringPiSetup () ; I get two errors .Into the header file this function is declared as external . I think there is a conflict because my project is C++ but the library is in C and then mistake when compile . Using the terminal I type make blink and then ./blink and it runs .
xwalter Posted May 29, 2016 Author Posted May 29, 2016 I solve this issue in this way . In Netbeans , right click over the project and I add a new link to this library /usr/lib/libwiringPi.so The files .so (shared object) are dinamic library such as the .dll in windows . Now Netbeans compile well . To run the project I have to run Netbeans as sudo from the terminal Otherwise I get an error in runtime WiringPiSetup Must be root ( Did you forget sudo ?) The WiringPiSetup() is a function to set up the board . I'm trying to do this ... I create a bash file #! /bin/bash sudo /usr/bin/gdb $* and I link to this file in Netbeans "Debugger Command" under properties , but it doesn't run , it runs just if I am sudo ....ufffff But anyway now I'm able to program my orangepi plus 2 in C/C++ by using Netbeans .Tomorroq I will connect some led's and resistors to see if true or not 1
xwalter Posted May 30, 2016 Author Posted May 30, 2016 ok guys ! In python the GPIO are running . In C/C++ are running . The pins are mapped in this way - pin26 --> PG8 (on board orange pi plus 2) - pin27 --> PG9 (on board orange pi plus 2) - pin28 --> PG6 (on board orange pi plus 2) - pin29 --> PG7 (on board orange pi plus 2) pins are used into the C files but on board are PG-x , i have tested one by one until I saw the led's were blinked , in netbeans also ok . I'd like to know if exists an header file to manage I2C ...??? I want to read and write some MCP23017 (16 expander I/O ) In some files of examples folder in WiringPi there is also how to get tick times , this is good to create millis() ,Arduino function . ciao Walter
xwalter Posted June 1, 2016 Author Posted June 1, 2016 I want to contribute this forum and people that are working on it , with those two video tutorial where I explain how to use the GPIO in C/C++ and python languages https://youtu.be/C8OSQ19Ebjo?list=PLJmvUGejM2TP5jt-xbKrCBU3QIe9MEXw_ 1
xwalter Posted June 1, 2016 Author Posted June 1, 2016 and C/C++... https://youtu.be/by_GOA9hSdU?list=PLJmvUGejM2TP5jt-xbKrCBU3QIe9MEXw_
IStar Posted June 8, 2016 Posted June 8, 2016 Hi XWalter! I got Orange Pi Plus 2 and Waveshare 5inch LCD. I found how I can chnge resolution to 800x480 but I still cant enable touchscreen:( I wiil be glad if you can help me with it! I see that you are profi with GPIO. OS:armbian Interface LCD: PIN NO. SYMBOL DESCRIPTION 1, 17 3.3V Power positive (3.3V power input) 2, 4 5V Power positive (5V power input) 3, 5, 7, 8, 10, 11, 12, 13, 15, 16, 18, 24 NC NC 6, 9, 14, 20, 25 GND Ground 19 TP_SI SPI data input of Touch Panel 21 TP_SO SPI data output of Touch Panel 22 TP_IRQ Touch Panel interrupt, low level while the Touch Panel detects touching 23 TP_SCK SPI clock of Touch Panel 26 TP_CS Touch Panel chip selection, low active now when I ask - ls /sys/class/gpio_sw/ I got: PA1 PA13 PA2 PA3 PA7 PA9 PC7 PG6 PG8 PA10 PA13 PA21 PA6 PA8 PC4 PD14 PG7 PG9 Please help me!!!!
xwalter Posted June 8, 2016 Author Posted June 8, 2016 hello ! Well my personal opinion to drive the lcd is to use a converter module in I2C. Currently I have not tried to make this thing yet but if you find in this forum you will find a project by Igor , dedicated project for that Take care for the pins .... I'm working with this one http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=975 ciao
David Van Cleef Posted June 9, 2016 Posted June 9, 2016 As someone trying to develop IoT projects with Node-Red, I'd like to eventually get the various node-red-node-pi* nodes working on Orange Pi (an OP lite with working wifi drivers acting as a AP for multiple ESP8266-based sensor/remote-device nodes would be my target for an inexpensive install). It looks like most of them seem to use the Python bindings, so might not end up being an extremely hard project.
msev Posted July 31, 2016 Posted July 31, 2016 So David do you have any news regarding integration with node-red? Also do you guys have any pointers on how to port code from github with Rpi.GPIO to other python bindings (WiringPi or pyA20)?
martinayotte Posted July 31, 2016 Posted July 31, 2016 For GPIO, take a look at https://github.com/duxingkei33/orangepi_PC_gpio_pyH3
David Van Cleef Posted August 1, 2016 Posted August 1, 2016 So David do you have any news regarding integration with node-red? Also do you guys have any pointers on how to port code from github with Rpi.GPIO to other python bindings (WiringPi or pyA20)? At the moment I'm just using exec nodes to manipulate GPIO at shell level. A 5-month-old in the house doesn't leave me with a huge amount of free time these days. I looked at the raspi-gpio stuff at one point but didn't get beyond fixing the raspian-dependent install stuff.
msev Posted August 21, 2016 Posted August 21, 2016 Does it do i2c too (lcd's for example 20x4 or 16x2 or even that oled ssd1103 or how its called )? What about max7219?
xwalter Posted February 7, 2017 Author Posted February 7, 2017 follow the martinayotte link It's the same I have used several months ago. Pratically the original library was written for raspberry pi . The library has an Arduino style , I mean for the name of the functions provided by it . Working with the I2C function you will find also something for the LCD in I2C If not you can arrange the orginal arduino Liquid_Cristal_I2C starting from the I2C native functione included in the wiringOP ciao
jasonp Posted February 26, 2017 Posted February 26, 2017 I just download and installed the latest "Orange Pi+ 2e" When i do the following I get nothing it is blank no io etc. > modprobe gpio-sunxi > ls -l /sys/class/gpio_sw >> total 0 Please help > uname -a >> Linux myboard 3.4.113-sun8i #10 SMP PREEMPT Thu Feb 23 19:55:00 CET 2017 armv7l armv7l armv7l GNU/Linux > cat /etc/issue >> Ubuntu 16.04.2 LTS \n \l > lsmod Module Size Used by bnep 9617 2 pcf8591 3363 0 bmp085 3487 0 8188eu 908230 0 btusb 11051 0 bluetooth 174097 21 bnep,btusb 8189es 1076034 0 btrfs 712409 0 > gpio readall +-----+-----+----------+------+---+--OrangePiPC--+---+------+---------+-----+--+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+ | | | 3.3v | | | 1 || 2 | | | 5v | | | | 2 | 8 | SDA.0 | ALT5 | 0 | 3 || 4 | | | 5V | | | | 3 | 9 | SCL.0 | ALT5 | 0 | 5 || 6 | | | 0v | | | | 4 | 7 | GPIO.7 | ALT3 | 0 | 7 || 8 | 0 | ALT4 | TxD3 | 15 | 14 | | | | 0v | | | 9 || 10 | 0 | ALT4 | RxD3 | 16 | 15 | | 17 | 0 | RxD2 | ALT5 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1 | 1 | 18 | | 27 | 2 | TxD2 | ALT5 | 0 | 13 || 14 | | | 0v | | | | 22 | 3 | CTS2 | ALT5 | 0 | 15 || 16 | 0 | ALT3 | GPIO.4 | 4 | 23 | | | | 3.3v | | | 17 || 18 | 0 | ALT3 | GPIO.5 | 5 | 24 | | 10 | 12 | MOSI | ALT4 | 0 | 19 || 20 | | | 0v | | | | 9 | 13 | MISO | ALT4 | 0 | 21 || 22 | 0 | ALT5 | RTS2 | 6 | 25 | | 11 | 14 | SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0 | 10 | 8 | | | | 0v | | | 25 || 26 | 0 | ALT3 | GPIO.11 | 11 | 7 | | 0 | 30 | SDA.1 | ALT4 | 0 | 27 || 28 | 0 | ALT4 | SCL.1 | 31 | 1 | | 5 | 21 | GPIO.21 | ALT3 | 0 | 29 || 30 | | | 0v | | | | 6 | 22 | GPIO.22 | ALT3 | 0 | 31 || 32 | 0 | ALT3 | RTS1 | 26 | 12 | | 13 | 23 | GPIO.23 | ALT3 | 0 | 33 || 34 | | | 0v | | | | 19 | 24 | GPIO.24 | ALT3 | 0 | 35 || 36 | 0 | ALT3 | CTS1 | 27 | 16 | | 26 | 25 | GPIO.25 | ALT3 | 0 | 37 || 38 | 0 | ALT3 | TxD1 | 28 | 20 | | | | 0v | | | 39 || 40 | 0 | ALT3 | RxD1 | 29 | 21 | +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+----------+------+---+--OrangePIPC--+------+----------+-----+-----+ all io is showing as 0? > cat /etc/modules 8189es #w1-sunxi #w1-gpio #w1-therm #gc2035 #vfe_v4l2 #sunxi-cir gpio-sunxi Thank you.
Recommended Posts