2017년 7월 15일 토요일

millis() in app inventor


I'm planning to make an app talk Arduino and my smartphone. I need some conditions related to time. I have to check that after 60 seconds the program chooses between two possibilities. In Arduino do so, but with app inventor?

if (millis() - time> 60000) {
    XXX
    time = millis();
  }

I am attaching a picture with blocks.


--
Pull in a Clock from the Sensors drawer in the Designer,
and turn off its repeat flag and its enabled flag,
to turn it into a one-shot timer.

Set it to your appropriate time interval, and enable it when you click the button.

In the clock timer event, do what you wanted to do 60 seconds after the button hit.

If you care about the interval between button clicks,
add an extra global variable and keep the last click instant(ms) in it.

-- 
Thanks now I feel. I have a question, I can plug in the clock components of the project? I have buttons other than timing.

-- 
See the How to Learn AI2 link in the Books and Tutorials
section of this FAQ ...

-- 

댓글 없음:

댓글 쓰기