how 'wait' be wrote on Monkey C???

I dont know how can I made it wait for one sec. 

anyone can help???????????????????????

  • You can't busy-wait in CIQ / Monkey C (you'll likely trip the watchdog timer, and it would be a bad user experience anyway), and there's no blocking wait() function like C, but you can set a timer to do something in the future.

    e.g. in the source file that has your view class:

    import Toybox.Timer;

    // ...
    // in your view class:

      var timer;

      function initialize() {
        timer = new Timer.Timer();
      }

      ...

      function scheduleTimer() {
        timer.start(method(:onTimerTimeout), 1000 /* milliseconds */, false /* don't repeat */);
      }

      function onTimerTimeout() {
        // do stuff when timer expires
      }
    // view class continues ...

    Note that there's a limit to the number of timers an app can create. I think on most (or all) devices the limit is 3. (The documentation says the "default" limit is 3 -- not really sure what "default" is supposed to mean in this case.)

  • If you want to block the UI in a friendly way for 1 second, you can display a ProgressBar (with busy indicator) and use a timer to dismiss it.