[Solved] API 2.0 void receive(const MyMessage& message) Problem
-
Hello, unfortunately is triggered no message here. The "textField" I applied and it is also available with a value. It is not even the "println" will be displayed. What am I doing wrong?
sleep(SLEEP_TIME); //sleep for: sleepTime } //incomingMessage_____________________________________________________ void receive(const MyMessage& message) { gasSensor.setR0(R0C); Serial.println(F("Incoming Message:")); }
-
@paqor I wouldn't put sensor readings in a message handler. Could you try this, just to test the messages?
wait(SLEEP_TIME); //sleep for: sleepTime // byTheo: Changed } //incomingMessage_____________________________________________________ void receive(const MyMessage& message) { // gasSensor.setR0(R0C); // byTheo: Changed // Serial.println(F("Incoming Message:")); // byTheo: Changed Serial.println("Incoming Message:"); }
And I also advice not to use sleep when having a node that can receive messages.
-
VIELEN VIELEN DANK!!!!
Thanks alot
-
@paqor That it solve your problem?
-
@TheoL said:
@paqor That it solve your problem?
Yes
https://gleisnetze.de/2016/08/07/sensoren4sketch-v0-6-under-contrstruction/
-
@paqor That's great. I looked at the Sketch you posted on your site and noticed you're still using a delay. Which as short as it may be can cause messages to be missed.
void loop(){ //----------------------------------------------------------------------------- //TEMP_FEUCHTE delay(dht.getMinimumSamplingPeriod());
My advice is to do this with a wait as well.
void loop(){ //----------------------------------------------------------------------------- //TEMP_FEUCHTE wait(dht.getMinimumSamplingPeriod()); // Changed ByTheo
That way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.
-
Okay, super, Thank you very much for your effort. I will correct it immediately
-
@TheoL said:
@paqor That's great. I looked at the Sketch you posted on your site and noticed you're still using a delay. Which as short as it may be can cause messages to be missed.
void loop(){ //----------------------------------------------------------------------------- //TEMP_FEUCHTE delay(dht.getMinimumSamplingPeriod());
My advice is to do this with a wait as well.
void loop(){ //----------------------------------------------------------------------------- //TEMP_FEUCHTE wait(dht.getMinimumSamplingPeriod()); // Changed ByTheo
That way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.
genial, works perfectly....