WiringOP sudo su with orange pi plus 2
0

14 posts in this topic

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 .

Share this post


Link to post
Share on other sites

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 

Tom_Neverwinter likes this

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!!!!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Does it do i2c too (lcd's for example 20x4 or 16x2 or even that oled ssd1103 or how its called :))? What about max7219?

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
0

  • Support the project

    We need your help to stay focused on the project.

    Choose the amount and currency you would like to donate in below.