Can anybody telll me how to make a simple timer?

howto

#1

hey can anyone tell me how to make a simple timer? I am a beginner and I saw a video of @pixibomb and ther is a timer can anyone tell just to build the timer. its image is here:-


#2

U’r Question is Match like this Topic
find the Discussion :point_right: Task Hour/Day + Countdown Timer + Prevent Hacking


#3

You’ll find the Clock Component under the Sensor Palette (in Design View).
The Clock is a Non-Visible Component. (You won’t see anything on the Design)
The Clock has 3 Main Properties:

  1. Timer Always Fires - If checked, the timer will fire even if the application is not showing on the screen.
  2. Timer Enabled - If checked, the timer will be ON.
  3. Timer Interval - Clock “ticks” measured in milliseconds. (1000 = 1 second)

The Clock has a lot of built-in procedures, you can read more about them here:
https://help.appybuilder.com/components/reference/sensors/clock

Side Note: You can create your own procedures in AppyBuilder (these blocks are color-coded purple). In Programming Languages, a “procedure” is also referred to as a function or method.

To create a Clock Event use the ClockName.Timer block.
Use this example to learn the basics of a Clock Event:

In Design View:

  • Add a Label Component to the Design. You can style this label however you want, it doesn’t matter. You can also delete or change the default Text Property.
  • Add a Clock Component to the Design. Don’t change anything.

In the Blocks Editor:
clock

  1. Create a global variable - You can name this whatever you want. I’ve decided to call it “T” (clock “ticks”).
  2. Give this variable a starting value -I’m going to make this Clock count down from 10 to 0. So my starting value is 10.
  3. Use the Clock Timer Event

CLOCK EVENT EXPLANATION
In the Design View, TimerEnabled is checked. This means the Clock is ON. The Clock will stay “on” until YOU turn it off. This means, you need to create a condition that turns the clock OFF.

Inside of this event we have a simple condition:

  1. If T is less than 0:
    turn the clock OFF (Clock1.TimerEnabled = false)
  2. OTHERWISE:
    display the value of T on the label (set Label1.Text to T)
    and decrement T by 1 (set T = T - 1)

A TimerInterval of 1000 means: this Clock will “tick” once every second.
As soon as the app starts, the Clock also starts.

CLOCK CONDITION EXPLANATION

  1. The app starts. T=10. The Clock is running.
  2. A condition occurs:
    a) Is 10 less than 0?
    b) No.
    c) Skip this condition, go to the else statement
    d) Label1.Text should display the value of “T” (which is 10)
    e) Decrease the value of “T” by 1 (10 - 1 = 9) … “T” now equals 9.
  3. One second has passed: loop back to the start of the event
  4. A condition occurs:
    a) Is 9 less than 0?
    b) No.
    c) Skip this condition, go to the else statement

etc…

WHAT WILL THIS DO?
The app will start.
Label1 will display the number 10.
One second later… Label1 will display the number 9.
One second later… Label1 will display the number 8.
and so on, until Label1 displays the number 0.
When T is less than 0, the Clock will turn itself OFF.

NOW THAT YOU KNOW THE BASICS
Can you visualize how the previous tutorial was accomplished?

Hope that helps :slight_smile:


#4

thank you very much mam, I am following you from a year and i talked to you for the first time you are so kind
thanks once again…


#5

sorry, mam for another question.
mam first to get time from time picker I mad a procedure like this:-


then I realized that I will produce argument error so for testing the timer I did this, There was also a mistake of a division at the the place of multiplication:- Screenshot%20(11)
now I am doing a mistake in timer and i know it is with the start time because in your tutorial there was a global variable wait which was assigned to a value and it was in somewhere middle in the block but in my block start time which is at the start, I am not getting how to solve it. Your tutorial was with firebase but I just want a simple timer with time picker.
my timer:-Screenshot%20(8)
please help once again…