Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Send data between FB(Send data between FB to RPI)
Send data between FB [message #1754024] Mon, 13 February 2017 21:39 Go to next message
Gustavo Caiza is currently offline Gustavo CaizaFriend
Messages: 3
Registered: February 2017
Junior Member
Hi,
Sorry for my english
I want to create new function blocks to control the digital inputs and outputs of the raspberry, when creating a function block if I can use the digital inputs and outputs, but when I create two FB one to declare the input pins and another to execute the process does not work, I do not know what is the problem, my code is bad or maybe I should also schedule the events.
I want to send data of type BOOL from one FB to the other, as I can do.?
Attached my code,
Thank you
Gustavo

***************
void FORTE_PRUEB1::executeEvent(int pa_nEIID){
switch(pa_nEIID){
case scm_nEventINITID:
wiringPiSetup();
pinMode (PIN1(), INPUT);
while(1)
{
if (digitalRead(PIN1())==0)
{VALUE1()=true;}
else {VALUE1()=false;}
}
sendOutputEvent(scm_nEventINITOID);
break;

*******************
void FORTE_PRUEBA2::executeEvent(int pa_nEIID){
switch(pa_nEIID){
case scm_nEventINITID:
wiringPiSetup();
pinMode (PIN2(), OUTPUT);
while(1)
{
if (true==VALUE2())
{digitalWrite(PIN2(),HIGH);}
else {digitalWrite(PIN2(),LOW);}
}
/*
do not forget to send output event, calling e.g.
sendOutputEvent(scm_nEventCNFID);
*/
break;
  • Attachment: rpi.png
    (Size: 37.97KB, Downloaded 27 times)
Re: Send data between FB [message #1754025 is a reply to message #1754024] Mon, 13 February 2017 22:12 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 454
Registered: January 2014
Senior Member
As stated in my other comment please consider using the existing IO FBs. If you wan to develop your own FBs please have a look on the tutorials in the 4diac docs. Especially the flip-flop tutorial should be there for you.
Previous Topic: digital inputs and outputs RPI
Next Topic:4DIAC: Copy-Paste FBs
Goto Forum:
  


Current Time: Mon Feb 19 14:50:46 GMT 2018

Powered by FUDForum. Page generated in 0.01885 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software