<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Raspberry PI 4, GPIO Configuration</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/bbb6a350f9/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/bbb6a350f9/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/bbb6a350f9/</id><updated>2020-12-05T10:58:14.467000Z</updated><subtitle>Recent posts to Raspberry PI 4, GPIO Configuration</subtitle><entry><title>Raspberry PI 4, GPIO Configuration</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/bbb6a350f9/?limit=25#fb1e" rel="alternate"/><published>2020-12-05T10:58:14.467000Z</published><updated>2020-12-05T10:58:14.467000Z</updated><author><name>mosfet</name><uri>https://forge.codesys.com/u/mosfet/</uri></author><id>https://forge.codesys.com69f3660df612ca444e2ccfe59e21152d47dc3211</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I also have the same problem. On the raspberry pi4 model B, the GPIOs controlled with Codesys do not work while if controlled with Python scripts they work correctly. Can someone help me?&lt;br/&gt;
Thanks&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Raspberry PI 4, GPIO Configuration</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/bbb6a350f9/?limit=25#2d84" rel="alternate"/><published>2020-11-04T15:46:04.385000Z</published><updated>2020-11-04T15:46:04.385000Z</updated><author><name>fjcano</name><uri>https://forge.codesys.com/u/fjcano/</uri></author><id>https://forge.codesys.com876ce0b00edb0fbeccdf9a6456b9c92b58a177cb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have a Raspberry PI 4 Model B, with the CODESYS CONTROL for RASPBERRY PI 3.5.16.20 runtime installed on it. I have bought a four relais module to control an AC load. In specific, the following one:&lt;br/&gt;
&lt;a href="https://www.az-delivery.de/es/products/4-relais-module" rel="nofollow"&gt;https://www.az-delivery.de/es/products/4-relais-module&lt;/a&gt;&lt;br/&gt;
I have connected the GPIOS 1 (3V3), 9 (GND), AND 11, (GPIO17) to the module and if I executed this simple python script i can command the connection/disconnection of the relay: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;RPi.GPIO&lt;/span&gt; &lt;span class="kn"&gt;as&lt;/span&gt; &lt;span class="nn"&gt;GPIO&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;time&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sleep&lt;/span&gt;

&lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setmode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BCM&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setwarnings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;Relay1PIN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;
&lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Relay1PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OUT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[press ctrl+c to end the script]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;# Main program loop&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Relay1PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HIGH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Relay1PIN&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="n"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Waitmode for 1 second&lt;/span&gt;
        &lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Relay1PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LOW&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Relay1PIN&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="n"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Waitmode for 1 second&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="ne"&gt;KeyboardInterrupt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Script end!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;GPIO&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cleanup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;My problem is that when I´m trying to implement this proccess in Codesys I can´t achive nothing. I have declared a global variable PIN_17 (figure 1). And in the GPIOS_B_PI2 Device at GPIOs Configuration i declare the GPIO17 as output (figure 2). Finally i associate at the GPIOs E/S asignation the bit 17 of the digital output array to my global variable "GVL_GPIO.PIN_17" (figure 3). The problem is when i change the value of the variable PIN_17 i cant connect/disconnect the relay. I dont know if I´m doing something wrong or I´m missing any step but any help would be grateful. &lt;/p&gt;
&lt;p&gt;In addition I have tried also with the other GPIOs device (GPIOs A/B) but the result is the same. Both versions are the 3.5.16.0 &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>