@KeithR
Thanks, I removed the return print() from the If statement inside the void print() function.
Thank you for your suggestions.
I followed your examples
int intPressure = 12;
int tweet = 0;
int val = 0;
void setup() {
}
void print() {
if(intPressure != 0)
{
Serial.println("HIGH");
tweet = HIGH;
}
else
{
Serial.println("LOW");
tweet = LOW;
}
return tweet;
}
void loop() {
int tweetStatus = print();
val = digitalRead(LED_BUILTIN);
digitalWrite(LED_BUILTIN, tweetStatus);
Serial.println("---");
Serial.println(val);
Serial.println("---");
}
and got 2 error messages :
Error A:
In function 'void print()':
test_bed:21: error:
return-statement with a value, in function returning 'void' [-fpermissive]
return tweet;
^
Error B:
In function 'void loop()':
test_bed:26: error:
void value not ignored as it ought to be
int tweetStatus = print();
^
exit status 1
return-statement with a value, in function returning 'void' [-fpermissive]
Despite the explanations regarding the error messages below, I don't understand them quite, yet:
Error A
It means a function is declared to return nothing (void) but you are assigning the return code to a variable.
source: void value not ignored as it ought to b - C++ Forum
Error B
The error means that in your function:
void* foo(...);
You have a statement:
return;
But the compiler expects a value to be provided:
return myVoidPtr;
Are the error messages saying that the return statement return tweet returns something that is not there?