Calling a serial command function

Support forum for MegunoLink
Post Reply
JohnPalmerGT
Posts: 3
Joined: Tue Jun 22, 2021 10:12 am

Thu Sep 23, 2021 7:49 am

Hi all,
I am trying to call a function that is also one of my serial command functions. I thought this could be an efficient way to reuse a serial command function's code.
For example if I have the following function, what syntax is required to call this function?

void Cmd_Clutch(CommandParameter &Parameters){
"CODE"
}

Thanks,
John
philr
Posts: 381
Joined: Mon May 26, 2014 10:58 am

Sat Oct 02, 2021 4:54 am

Hi John, are you planning on pulling variables out of it when you run that function or just triggering some other code?
JohnPalmerGT
Posts: 3
Joined: Tue Jun 22, 2021 10:12 am

Mon Oct 04, 2021 8:04 am

Hi, I will just be running the code inside the function.
philr
Posts: 381
Joined: Mon May 26, 2014 10:58 am

Mon Oct 11, 2021 7:04 am

I think you should just create a separate function that is reusable. Call it from inside the command handler function and elsewhere in your code.
JohnPalmerGT
Posts: 3
Joined: Tue Jun 22, 2021 10:12 am

Mon Oct 11, 2021 7:11 am

That is a very simple logical solution, thanks.
Post Reply