Skip to main content
Add more detail
Source Link
user31481
user31481

My_Decoder.value doesn't change inside obstacle_avoiding(). Hence, while is running infinitely.

I think you have to delete the while, and let loop() take care of controlling the execution.

Addendum

The intent of the loop() is to read some IR data in value. I under the impression that getResults() sometimes block, acording to this:

However the IRrecvLoop is not interrupt driven and so when you call GetResults it sits in a tight loop and does not release control back to you until the complete signal has been received.

I also want to check that value doesn't change if getResults() return nothing with this loop()

void loop() {
bool r = My_Receiver.GetResults(&My_Decoder)
Serial.print("getResults()=");
Serial.print(r);
Serial.print(" value=");
Serial.println(My_Decoder.value);

if (r) {
    //Restart the receiver so it can be capturing another code
    //while we are working on decoding this one.
    My_Receiver.resume();
    My_Decoder.decode();
} else {
    if (My_Decoder.value == 0xFF807F && My_Decoder.value != 0xFF0AF5) {
        obstacle_avoiding();
        }
    }
}

I hope this works!

My_Decoder.value doesn't change inside obstacle_avoiding(). Hence, while is running infinitely.

I think you have to delete the while, and let loop() take care of controlling the execution.

My_Decoder.value doesn't change inside obstacle_avoiding(). Hence, while is running infinitely.

I think you have to delete the while, and let loop() take care of controlling the execution.

Addendum

The intent of the loop() is to read some IR data in value. I under the impression that getResults() sometimes block, acording to this:

However the IRrecvLoop is not interrupt driven and so when you call GetResults it sits in a tight loop and does not release control back to you until the complete signal has been received.

I also want to check that value doesn't change if getResults() return nothing with this loop()

void loop() {
bool r = My_Receiver.GetResults(&My_Decoder)
Serial.print("getResults()=");
Serial.print(r);
Serial.print(" value=");
Serial.println(My_Decoder.value);

if (r) {
    //Restart the receiver so it can be capturing another code
    //while we are working on decoding this one.
    My_Receiver.resume();
    My_Decoder.decode();
} else {
    if (My_Decoder.value == 0xFF807F && My_Decoder.value != 0xFF0AF5) {
        obstacle_avoiding();
        }
    }
}

I hope this works!

My_Decoder.valueMy_Decoder.value doesn't change inside obstacle_avoiding()obstacle_avoiding(). Hence, "while"while is infinityrunning infinitely.

I think you have to delete the "while"while, and let loop()loop() take care of controlling the execution.

My_Decoder.value doesn't change inside obstacle_avoiding(). Hence, "while" is infinity.

I think you have to delete the "while", and let loop() take care of controlling the execution.

My_Decoder.value doesn't change inside obstacle_avoiding(). Hence, while is running infinitely.

I think you have to delete the while, and let loop() take care of controlling the execution.

Source Link
user31481
user31481

My_Decoder.value doesn't change inside obstacle_avoiding(). Hence, "while" is infinity.

I think you have to delete the "while", and let loop() take care of controlling the execution.