Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation of your ask).
—-
You can’t use a local variable in another function. Make it global or return it or pass that as a parameter
Do you mind to show how to return or pass that as parameter?
I get confused on tat..
I am sorry that I am still not familiar with the code tags n those..
Done all I can given the limited information you've supplied. Might be able to help more if you posted the complete code and GitHub links to any libraries you're using. Be good if you identified which Arduino board also.
Here is an example. But you should read a programming tutorial to get a fine understanding of functions, parameters, types etc
int getReturnValue() {
return 42;
}
void getReferenceValue(int& x) { // pass by reference, notice the &
x = 42;
}
void setup() {
int v1=0, v2=0;
v1 = getReturnValue(); // now v1 is 42
getReferenceValue(v2); // now v2 is 42
}
void loop() {}
Alright, but what if I need that variable in another function too? for example, I want to return more than one value from void send into void loop first, then I use it in void receive?
I know that the void should be changed to either int/char/others accordingly, am I right?