PROGRAMpowerVARÂ Â Result:UDINT;END_VARIFGlobalVariables.resetFromVISUTHENÂ Â GlobalVariables.power_led:=FALSE;Â Â _(pszComand:='sudo reboot',pResult:=ADR(Result));END_IFIFGlobalVariables.poweroffFromVISUTHENÂ Â GlobalVariables.power_led:=FALSE;Â Â _(pszComand:='sudo poweroff',pResult:=ADR(Result));END_IF
and
[SysProcess]Command=AllowAll
in CODESYSControl_User.cfg file
I hope this will help.
When I write in code syntax SysProcess_Execute_Command after submit I see only "_" why?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PROGRAMpowerVAR
  Result: UDINT;END_VARIFGlobalVariables.resetFromVISUTHEN
  GlobalVariables.power_led :=FALSE;
  _(pszComand:='sudo reboot' , pResult:=ADR(Result));END_IFIFGlobalVariables.poweroffFromVISUTHEN
  GlobalVariables.power_led :=FALSE;
  _(pszComand:='sudo poweroff' , pResult:=ADR(Result));END_IF
and
[SysProcess]Command=AllowAll
in CODESYSControl_User.cfg file
I hope this will help.
When I write in code syntax SysProcess_Execute_Command after submit I see only "_" why?
I've got it all working now.
Thank you for your help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For me this does not work. I think my Raspberry Pi does restart, but not Codesys. I even cannot access the Pi via ssh or other remote communication protocols! I have to reconfigure the SD card of the Pi that it works again.
Good morning,
I'm pretty new to codesys and the programming side of raspberry.
I'm trying to power off my raspberry using my HMI.
I've found some other examples, but I couldnt get them to work:
l viewtopic.php?t=8638 l - Keep getting syntax errors
l viewtopic.php?f=21&t=5714 l - No errors, it just doesnt power off
I'm using ladder logic to program the raspberry.
Can somebody explain how to do it?
http://forum.codesys.com/viewtopic.php?f=23&t=6247&p=12699#p12699
I use this:
and
in CODESYSControl_User.cfg file
I hope this will help.
When I write in code syntax SysProcess_Execute_Command after submit I see only "_" why?
and
in CODESYSControl_User.cfg file
I hope this will help.
When I write in code syntax SysProcess_Execute_Command after submit I see only "_" why?
I've got it all working now.
Thank you for your help!
For me this does not work. I think my Raspberry Pi does restart, but not Codesys. I even cannot access the Pi via ssh or other remote communication protocols! I have to reconfigure the SD card of the Pi that it works again.
I use this command and SysProcess is as above:
SysProcess.SysProcessExecuteCommand2(pszCommand:='sudo reboot', pszStdOut:=stdout, udiStdOutLen:=31 , pResult:=0 );
Last edit: kleeswi 2022-07-05
remove the sudo!