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: https://www.az-delivery.de/es/products/4-relais-module
I have connected the GPIOS 1 (3V3), 9 (GND), AND 11, (GPIO17) to the module and if I execute this simple python script i can command the connection/disconnection of the relay:
importRPi.GPIOasGPIOfromtimeimportsleepGPIO.setmode(GPIO.BCM)GPIO.setwarnings(False)Relay1PIN=17GPIO.setup(Relay1PIN,GPIO.OUT)print('[press ctrl+c to end the script]')try:# Main program loopwhileTrue:GPIO.output(Relay1PIN,GPIO.HIGH)print(GPIO.input(Relay1PIN))sleep(1)# Waitmode for 1 secondGPIO.output(Relay1PIN,GPIO.LOW)print(GPIO.input(Relay1PIN))sleep(1)# Waitmode for 1 secondexceptKeyboardInterrupt:print('Script end!')finally:GPIO.cleanup()
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.
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
Hello,
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?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
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:
https://www.az-delivery.de/es/products/4-relais-module
I have connected the GPIOS 1 (3V3), 9 (GND), AND 11, (GPIO17) to the module and if I execute this simple python script i can command the connection/disconnection of the relay:
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.
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
Thanks,
Last edit: fjcano 2020-11-04
Hello,
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?
Thanks