CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Dec 16, 2018 7:32 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Dec 03, 2015 8:12 am 
Offline

Joined: Sun Oct 25, 2015 7:33 am
Posts: 12
Hello,

I want to play AUDIO files with my RPI2. What do I have to do in Codesys? My idea is to play AUDIO files when some digital bit is ON.

regards


Top
   
PostPosted: Thu Dec 03, 2015 3:34 pm 
Offline

Joined: Thu Sep 17, 2015 8:47 pm
Posts: 12
Hello:

Enable commands at /etc/CODESYScontrol.... (do not remember right name), add to settings:
Code:
[SysProcess]
Command=AllowAll

OR more safety:
Code:
[SysProcess]
Command.0=aplay
Command.1=mplayer
...




In Codesys program add variable:
Code:
VAR
   cmdResult   :    RTS_IEC_result;               // Command Result
END_VAR

And use command for play the sound (for aplay command):
Code:
SysProcess***ExecuteCommand('aplay /theway/tomusic/sound.wav', ADR(cmdResult));    // Delete that "***", I have to add it because forum filtering it


Remember, that program will stop at command until the sound is played. Its better to make 2nd Task for sound playing with using some buffer or mark at GLOBAL VARIABLE.
Code:
IF soundState THEN SysProcess***ExecuteCommand('aplay /theway/tomusic/sound.wav', ADR(cmdResult)); soundState:= FALSE; END_IF     // Delete that "***", I have to add it because forum filtering it


Maybe you have to add library:
SysTypes Interfaces
SysProcess


Top
   
PostPosted: Fri Dec 04, 2015 7:05 pm 
Offline

Joined: Sun Oct 25, 2015 7:33 am
Posts: 12
Thank you! This worked fine.


Top
   
PostPosted: Sun Mar 13, 2016 3:23 pm 
Offline

Joined: Thu Mar 10, 2016 10:56 pm
Posts: 1
jvondrus wrote:

Maybe you have to add library:
SysTypes Interfaces
SysProcess


Hallo jvondrus,

How can I add this library?
Thanks, your help!

regards


Top
   
PostPosted: Sun Mar 13, 2016 4:12 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3019
Hi,
see screenshot just type in what you know from the library - name of an FB or name of the Lib

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue Nov 15, 2016 8:28 pm 
Offline

Joined: Thu Oct 06, 2016 8:18 pm
Posts: 6
Hello,

I am currently testing a video file with:

Video_1: STRING: = 'sudo omxplayer -o both /home/pi/media/test.mp4';

The file is also played via the "omxplayer".
Works perfect,
But how can I finish playing that prematurely?

In the terminal I press "q"

is that possible?

Thank you very much
mfg mike


Top
   
PostPosted: Mon Mar 20, 2017 7:23 pm 
Offline

Joined: Mon Mar 20, 2017 5:43 pm
Posts: 4
Edit: I got it working. Now that I have an account I can see the screenshot mentioned above. Just an addition, I had to click on the "display advanced libraries" in the Add Library window.

I am interested in getting this code to work on my Raspberry Pi 3 using CODESYS V3.5 SP10 P2 +. I have SysTypes Interfaces (3.5.2.0) and SysProcess (3.5.7.0) installed. I'm very new to CODESYS and Raspberry Pi.

In declaring the variable cmdResult, there is an error "Identifier 'RTS_EIC_result' not defined". I also tried
Code:
cmdResult   : POINTER TO RTS_IEC_result;

but I get the same error.

Also, regarding the SysProcess***ExecuteCommand (minus the ***) I have the same "Identifier not defined" error. Is there an "Import" that I'm missing?

jvondrus wrote:
Hello:


Top
   
PostPosted: Tue Oct 30, 2018 8:24 pm 
Offline

Joined: Tue Apr 12, 2016 2:58 am
Posts: 1
I also have the same error RTS_IEC_RESULT Module not found, does anyone knows how to solve this problem.

Thank you best regards


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 5 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