CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sat Apr 21, 2018 6:19 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Mar 29, 2018 1:09 am 
Offline

Joined: Thu Feb 08, 2018 5:01 pm
Posts: 10
Hi,

I have a python script that sends a sms message to my phone when its run.
I want this code to run when a led in codesys turns on.

I can't figure out how to do this. I know that codesys can run python by using tools, scripting, execute script.

I just want the code to run automatically to alert me of an alarm.

Thanks for the help.


Top
   
PostPosted: Fri Mar 30, 2018 7:06 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2627
Hi,
this sms you want to send on an alarm or IO triggered by the plc and send by the plc
not in the CODESYS developmentsystem?
Because this python scription here is all in the CODESYS developmentsystem not in the plc.

If you need this for the plc side,
this example here should show how this could work:
(But this works only if the plc side could execute python...)
viewtopic.php?f=23&t=6247&p=19932#p19941

BR
Edwin


Top
   
PostPosted: Thu Apr 05, 2018 8:24 pm 
Offline

Joined: Thu Feb 08, 2018 5:01 pm
Posts: 10
Thanks for the help.

I am using the PLC to run the python code. It can run the code on it's own.

I cant seem to get my code to run. I don't have the hardware to test yours but I used your example to make my code.
It seems to run the code but it does not do anything. I have tested my python code on its own and it does work.


Top
   
PostPosted: Sat Apr 07, 2018 7:12 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2627
Hi,
so on which plc do you execute this?

BR
Edwin


Top
   
PostPosted: Wed Apr 11, 2018 10:20 pm 
Offline

Joined: Thu Feb 08, 2018 5:01 pm
Posts: 10
I am running it on a raspberry pi 3 model B.
I am trying to have the single file run when a bool value = true.
I can't seem to get it to work through Codesys though.


Edit:

Never mind I got it to work.

Thanks for all the help though.


Top
   
PostPosted: Sun Apr 15, 2018 11:53 am 
Offline

Joined: Wed Oct 25, 2017 10:03 am
Posts: 5
Could you specify how you made it work? I am trying to run a Python Script on a Raspberry 3 B with the _ and it does not do anything. Running the script via the command line works fine.
I would appreciate any help.


Top
   
PostPosted: Sun Apr 15, 2018 5:46 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2627
Hi,
did you check this?
viewtopic.php?f=23&t=6247&p=19932#p19941
BR
Edwin


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited