1The result of a void function is stored
Declare the function with the type it returns, and add a return line.
Broken
void work() {
Serial.println("working");
}
void setup() {
Serial.begin(9600);
int total = work();
}
void loop() {
}Fixed
int work() {
Serial.println("working");
return 3;
}
void setup() {
Serial.begin(9600);
int total = work();
Serial.println(total);
}
void loop() {
}