[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:")); } -
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.
-
@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 ByTheoThat way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.
-
@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 ByTheoThat way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.
@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 ByTheoThat way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.
genial, works perfectly....
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login