• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NIOT-E-NPIX-4DI4DO with netpi-netx container
#1
Hello Armin.
I use NIOT-E-NPI3-51-EN-RE with NIOT-E-NPIX-4DI4DO module inserted.
I work with profinet, thats why  ntpi-netx-programming-examples container is installed.
Now I need access to 4DI4DO.
1. Where can I find GPIO numbers, to which this module is connected?

2. How can I get access to GPIOs from ntpi-netx-programming-examples container? (preferably from C++ code). Do I need to install wiring-pi?


Thank you.
Best regards,
Walter.
  Reply
#2
Hi,

all documents around netPI can be found here: https://www.netiot.com/netpi/industrial-raspberry-pi-3/. There you find also a common documentation for NPIX modules and also which GPIOs are physically connected it.

In order to show how NPIX modules can be used in the context of netPI I made a Node-RED (this is my preferred "language" doing it in node.js/javascript) container which includes two Node-RED nodes to read and write the NPIX IOs. The container is located here https://hub.docker.com/r/hilschernetpi/netpi-nodered

In detail the source code of the Node-RED npix-io nodes used in this container is located here https://github.com/HilscherAutomation/ne...ed-npix-io

To grant access in general to GPIOs within a Docker container the device
Code:
/dev/gpiomem

needs to be mapped to the container independent which application wants to access the GPIOs. After mapping this device the GPIOs are automatically generated in the container following path as it is usual for Linux GPIOs

Code:
/sys/class/gpio

Of course you could also read/write to GPIOs directly from a Linux shell as described here: https://sites.google.com/site/semilleroa...rials/gpio with a simple command like the following:

Code:
echo 0/1 > /sys/class/gpio/gpioxx/value

There are also other examples on the web showing how to use Raspberry Pi GPIOs with languages like python, C or C++. netPI contains a standard Raspberry Pi 3B circuitry and everything you find on the web related to GPIOs is applicable. I personally can't give you a link how to do it in C++. I found this web page here https://www.digikey.com/en/maker/blogs/2...-pi-with-c with google search, but I don't know if it is good for you. It might be that my reply for you as a C++ programmer might be just useful for you to get to know the used GPIOs only.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Thank you, Armin.
That works!

Best regards,
Walter.
  Reply
#4
(October-16th-2020, 02:52 PM)Armin@netPI Wrote: Hi,

all documents around netPI can be found here: https://www.netiot.com/netpi/industrial-raspberry-pi-3/. There you find also a common documentation for NPIX modules and also which GPIOs are physically connected it.

In order to show how NPIX modules can be used in the context of netPI I made a Node-RED (this is my preferred "language" doing it in node.js/javascript) container which includes two Node-RED nodes to read and write the NPIX IOs. The container is located here https://hub.docker.com/r/hilschernetpi/netpi-nodered

In detail the source code of the Node-RED npix-io nodes used in this container is located here https://github.com/HilscherAutomation/ne...ed-npix-io

To grant access in general to GPIOs within a Docker container the device
Code:
/dev/gpiomem

needs to be mapped to the container independent which application wants to access the GPIOs. After mapping this device the GPIOs are automatically generated in the container following path as it is usual for Linux GPIOs

Code:
/sys/class/gpio

Of course you could also read/write to GPIOs directly from a Linux shell as described here: https://sites.google.com/site/semilleroa...rials/gpio with a simple command like the following:

Code:
echo 0/1 > /sys/class/gpio/gpioxx/value

There are also other examples on the web showing how to use Raspberry Pi GPIOs with languages like python, C or C++. netPI contains a standard Raspberry Pi 3B circuitry and everything you find on the web related to GPIOs is applicable. I personally can't give you a link how to do it in C++. I found this web page here https://www.digikey.com/en/maker/blogs/2...-pi-with-c with google search, but I don't know if it is good for you. It might be that my reply for you as a C++ programmer might be just useful for you to get to know the used GPIOs only.

Thx
Armin
Thanks Armin, will try this one out and roadrunner email update you soon.
Thanks again.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  NIOT-E-NPIX-RS485 LucioFiam 6 3,987 January-21st-2023, 05:20 PM
Last Post: Armin@netPI
  TOSILOCK for CONTAINER COswald 3 2,182 July-13th-2021, 11:32 AM
Last Post: Armin@netPI
  Access to RTC from my own container application tad 1 3,520 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  [SOLVED] Starting services/commands/scripts at startup of a container Jonas.Sellmann@outlook.de 9 6,011 March-9th-2021, 08:47 AM
Last Post: WalterSchaefer
  OpenVPN container Armin@netPI 0 1,612 January-3rd-2021, 12:13 PM
Last Post: Armin@netPI
  operating Console of a container on netPI connected to Wi-Fi tethering tad 3 2,611 December-3rd-2020, 12:32 PM
Last Post: tad
  NPIX-4DI4DO and NetPi-Nodered container issues alhammi 4 7,581 November-16th-2020, 01:35 PM
Last Post: alhammi
  Get host MAC via REST API inside container bschandra 4 3,640 November-16th-2020, 09:26 AM
Last Post: bschandra
  netPI-netx-programming-examples update slos 12 7,576 September-14th-2020, 07:06 PM
Last Post: Armin@netPI
  using node.js on NIOT-E-TP151-EN-RE COswald 9 10,103 May-20th-2020, 12:54 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)