Send data between FB [message #1754024] |
Mon, 13 February 2017 21:39 |
Gustavo Caiza 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 118 times)
|
|
|
Re: Send data between FB [message #1754025 is a reply to message #1754024] |
Mon, 13 February 2017 22:12 |
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03374 seconds