Custom command in Arduino

Hi,

I am writing a code to control a dc motor using the pwm output in arduino UNO. I have written a labview program to write some variables and read the analog input directly using LINX command in labview. I want to hold the void loop program until the custom command is executed because it takes more time to execute the custom command.

Atleast I need to reference the variables inside the custom command in the Void loop(). How to do this. Pls explain.

I have attached ino in a single zip file for better understanding.

Regards,

X. Ignatius

Arduino_Uno_Serial_m.ino (1.63 KB)

Atleast I need to reference the variables inside the custom command in the Void loop(). How to do this. Pls explain.

What variables in the function do you want to access?

The ONLY way to do so is to copy them, when the function is called, to global variables, and have loop(), or other functions, access the global variables.

Hi,

I need input[0] & input[1] in the function to be used inside void loop().

Can I declare them globally and use them anywhere?

Regards,
X. Ignatius

Can I declare them globally and use them anywhere?

Yes.

Just be aware that they will be accessible, and have some value, even if that function has not been called.