Strange Behavior of "When Started"

Issue #105 resolved
Turgut Guneysu created an issue

Hi John,

I came across this weirdness in one of my programs. Here is a code segment that exhibits the behavior.

  • I STOP the program, and then press START once.
  • The first When Started executes, and then only the 3rd When Started loop executes, and is highlighted.
  • The 2nd When Started is not executing, and causing me problems with what it doesn’t do !
    I put in a LED blink in it to recognize execution. The initial blinking when RESET is the Hotspot starting.
  • I press START one more time, then all When Started loops execute, and the program runs correctly.
    LED blinks repeatedly. There is a green halo around both 2nd and 3rd When Started loops.

* RINSE and REPEAT every time with the same result.

I tried creating other triple When Started programs, but none of them exhibit this strangeness.

Is there something you can detect unique to this code?

Attached is the actual program.

Comments (5)

  1. John Maloney repo owner

    Could the UART blocks be hanging, looping, or failing? No idea what they do, but there is one in each of the scripts that doesn’t appear to be starting…

  2. Turgut Guneysu reporter

    This ended up being a programming problem that never gave an error before.

    In the latest version, it produces an error: “attempt to access an argument outside of function”.

    Upon inspection, I have found that in one WHEN STARTED block I was trying to access variables that were not yet initialized in other WHEN STARTE blocks. Hence the problem. The old version never displayed the error, but the new one does and it was easy to find out.

    OK, no problem anymore !

  3. Log in to comment