Is there a simple way to reboot the "Pi" when an GPIO input contact is closed?
I'm planning on having a "System Reboot" button on the front panel of the completed system and can't seem to find the "CODESYS" way of commanding this as oppose to generating a seperate script on the Pi.
you need to do the following steps:
1. Pi side
add the section and command which you want to execute in CODESYSControl.cfg (this is under /etc)
See Screenshot config.jpg
In CODESYS Library Manager you need to add Sysprocess.library and SysTypes.library
See screenshot reboot.jpg - how to execute it in CODESYS:
You are the man Edwin.
I would like executing a script via "Sys Process Execute Command" or another Function out of the library.
I tried different commands in the .cfg file but it doesnt work.
Could anyone tell me how i can start a script sucessfully?
Hi, which command did you add to the config and what do you call in the codesys code exactly?
The Function in Codesys was "Sys Process Execute command " pzsCommand "switch"
In CODESYSControl.cfg i ve insert :
for me the solution was to move my script 'script_run' to /usr/bin
and in the CODESYSControl.cfg you enable it by
In Codesys I call it by:
Now again the Beginning:
I made a new script switch.sh, then I set it executeable.
The Script sends a 433 Mhz Signal , GPIO17
On the Raspberry Pi i can execute the Script and the Signal generates sucessfully
I moved my Script "switch.sh" to /usr/bin/ and set up the Codesys Program.
Now i set the Bit START_SCRIPT but nothing happend,
has anyone a idea what went wrong?
either call 'script.sh' in CODESYS or rename your script in /usr/bin to script
you could check if the script is executed with cat /tmp/codesyscontrol.log
Thanks a lot!!!
Finally it works i think i was mentally blocked...
may I ask what exactly you are realize with the 433 Mhz Signal on GPIO17?
If nothing is configured, Sys Execute Command will always fail.
In addition to that, it is also possible to ignore the above white list and allow all commands by: Command=AllowAll
ATTENTION: If Command=AllowAll is set, there is no further verification done, before a command is executed. Please check your security requirements carefully before activating this. For the same reason you should also choose the allowed commands in the list accurately.
IF xRun THEN
SysProcess.S ysProcessE xecuteCommand('echo test > /dev/ttyO1', ADR(Result));
xRun := FALSE;
Habe ein Problem bekomme immer 25 als rückgabe von Result
was hast du in der CODESYSControl.cfg eingetragen und welches Kommando
rufst du denn auf in Codesys?
Ich habe das Skript unter /usr/bin/ angelegt und ausführbar gemacht!(in Putty funktioniert das skript)
In der CODESYSControl.cfg habe ich folgende Einträge gemacht
Der Aufruf in Codesys sieht so aus
IF (xSendMail) THEN
_('cs_mail' , ADR(Result) );
Result ist nach dem Ausführen auf 25
Was mache ich falsch?
hast du das script mit dem gleichen User und Rechten über Putty ausgeführt wie codesys es ausführt?
Hi, I know its an older thread and it was helping me a lot, but in my case when pi reboots all my data are lost. How was it in your case or do you know how to solve such an issue?
But: To retain the variables, the variables have to be declared as retain ;-) and are only reliable saved, if the system process "shutdown/reboot" is used.
Log in to post a comment.