Jump to content


Photo

WiringOP sudo su with orange pi plus 2


  • Please log in to reply
12 replies to this topic

#1 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 29 May 2016 - 11:35 PM

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 .



#2 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 30 May 2016 - 12:59 AM

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

#3 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 30 May 2016 - 11:30 PM

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



#4 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 01 June 2016 - 01:14 AM

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/C8O...KrCBU3QIe9MEXw_


  • Igor likes this

#5 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 01 June 2016 - 01:16 AM

and C/C++...

https://youtu.be/by_...KrCBU3QIe9MEXw_



#6 IStar

IStar

    Member

  • Senior Members
  • PipPip
  • 10 posts

Posted 08 June 2016 - 09:35 AM

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



#7 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 08 June 2016 - 11:42 AM

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....wthread&tid=975

ciao



#8 David Van Cleef

David Van Cleef

    Member

  • Senior Members
  • PipPip
  • 17 posts

Posted 09 June 2016 - 03:37 AM

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.



#9 msev

msev

    Advanced Member

  • Senior Members
  • PipPipPip
  • 76 posts

Posted 31 July 2016 - 07:44 AM

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



#10 martinayotte

martinayotte

    Advanced Member

  • Senior Members
  • PipPipPip
  • 442 posts

Posted 31 July 2016 - 02:33 PM

For GPIO, take a look at https://github.com/d...pi_PC_gpio_pyH3



#11 David Van Cleef

David Van Cleef

    Member

  • Senior Members
  • PipPip
  • 17 posts

Posted 01 August 2016 - 02:27 AM

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.



#12 msev

msev

    Advanced Member

  • Senior Members
  • PipPipPip
  • 76 posts

Posted 21 August 2016 - 10:14 PM

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



#13 xwalter

xwalter

    Advanced Member

  • Senior Members
  • PipPipPip
  • 97 posts

Posted 07 February 2017 - 12:20 PM

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