|   FORUM      |     Tutoriales    |     KIO4 |      
   Start B4A (Basic4Android) App inventor 2 Arduino
   Elastix - VoIP Things of Windows Interesting Webs  Telecomunications

 


Nuevo concurso para España, Argentina, Brasil, Chile, Colombia, Ecuador, México, Perú y Portugal.

App Inventor 2
Programming mobi
le phones with Android 
by App Inventor 2 - Juan Antonio Villalpando

- Initiation Tutorial App Inventor 2 -

Return to tutorial index

____________________________

47.- Countdown. If then. Clock. Sound.

ip47_count_down

- Presentation.

- Write a number, press the Start button and Label an account is displayed down to zero, plus a sound is heard.
- When it reaches zero, another sound finishing hear, the screen turns red.
- When you press the Stop button, for the account, but if pressed again, the account continues.

_________________
Design

- The TextgBox has Properties "NumberOnly". Hight = 40.
- At Buttons and Labels put them to the desired size. Label the X has a size of 80.

- The Clock we put a TimeInterval 1000 (this is a second). And uncheck TimerEnabled.

- Upload two Sound files. In the Property Source of them we put their names.

beep11.mp3

beep15.mp3

_________________
Blocks

When you press the Button, initial conditions are set:
- Enable the Clock.
- Set the number of TextBox1 in variable n.
- Put the BackGroundColor screen in white.

When the clock starts counting:

Subtracts one to the variable n.
Put the Label value of n.
Rings Sound1.
Compare if n is zero, in this case Pause Sound1 and rings Sound2, for the clock, puts the BackGroundColor screen in Red .

When you press the Button2, you see how is the Clock, if enabled of disabled and if disabled is enabled.

In addition, the text is changed Button2.


____________________

Proposal

- Modify the code so that the number entered must be between 10 and 30 , ie, when you press Button1 will check if the number is between these values.

- If it is not, will a notification to this effect.

Try something like this ...

If x <10 O x> 30 Then

Error Notifier.

__________________________________

 

- My e-mail:
juana1991@yahoo.com
- Who I am. - Cookies. Texts and images propierty autor:
© Juan A. Villalpando
Not copy texts neither images.
We use our own cookies and third-party cookies on our websites to maintain the session and your preferences, customize your user experience and obtain website use statistics.
Si continúa navegando consideramos que acepta su uso. OK    Más información