2014년 11월 29일 토요일

can mit app inventor trigger an alarm???

i want to make an android application that can trigger and alarm when i read some data at the certain point..
can anybody here help me??

--
You can use the Sound or Player component to start a short mpg3 sound bite stored as a resource or use the Vibrate block.

What have you tried?    Post some blocks and you will get specific advice from someone.

--
If you're asking about Push Notifications, the answer is no.

--
 Capture.PNG
this is my block..
i want when i the global temperature achieve or more than 30 it trigger the sound??
is my step true??

--

You first have to establish whether the bluetooth device is reporting any temperature data at all .    Is your device reporting a temperature value?   This chapter shows how to use the AI2 debugger called DoIt ..http://www.appinventor.org/bookChapters/chapter15.pdf. You can use it to provide values  or write a simple project to see if bluetooth is recording temperatures.

After that is done, you can read about the proper way to use logic blocks to establish a condition (like temperature above 30) by reading  http://www.appinventor.org/bookChapters/chapter18.pdf  

--
In addition to what Steve said above, remember that your app may go to sleep, or may be shut down unexpectedly by the Android OS... you would only get the alert sound you desire if the app is running and in the foreground.

--
my device has been reporting the temperature..now here the other problem I face..
the sound keep playing whatever the temperature value.. 

--
Keep a global variable that tells you whether or not the alarm has been sounded... if it's true, then don't sound it again.

--
 forum.PNG

this is my latest code block..its keep play the alarm what ever the value of temperature..did i wrong?

--

i want when i the global temperature achieve or more than 30 it trigger the sound??


I would use an if statement like this:

if get global temperature > 30
then Sound.Play

--
The way you've written that block, the sound will play every time the clock (timer) fires.  You need to move the SoundPlay block up where you're doing the test.

Right now, the sound plays constantly.  Also, the evaluate but ignore block doesn't do anything.  It just evaluates the statement but completely ignores the result.

You need an if statement as Taifun showed you above.

--

댓글 없음:

댓글 쓰기