Help Any one give me info where i find one digital timer for Android mode

Read topic
Any info
Tankyou

read Guidelines—Asking Questions
thank you

1 Like

hide ellipse int duration = 1000; change the duration you change time you can text the time


int startMillis;
int duration = 1000;

void draw() {
  background(0);
  if (mousePressed) {
    startMillis = millis();
  }

  if (millis() < startMillis + duration) {
    ellipse(mouseX, mouseY, 10, 10);
  }
}

:

// The duration of the timer
int timerDuration = 2000;

// The time at which we start the timer
int startTime = 0;

// Whether or not the timer was started
boolean timerStarted = false;

void setup() {
  size(200, 200);
}

void draw() {
  background(255);
  
  if (timerStarted) {
    // We subtract the current time and the time when we started the timer
    int currentDuration = millis() - startTime;
    
    fill(0);
    textAlign(CENTER, CENTER);
    text(currentDuration, width / 2, height / 2);
    
    // If the event is over
    if (currentDuration > timerDuration) {
      timerStarted = false;
    }
  }
}

// When the mouse is pressed, take the current time and store it
void mousePressed() {
  startTime = millis();
  timerStarted = true;
}
1 Like

I was wrong to post the code but could it be used for the timer?

long time = 25*60000;
void setup() {
  size(300,300); 
}

boolean running = false;
long start = millis();
float a = 0;

void draw() {
  if ( running ) {
    a = (millis() - start)* TWO_PI/time;
    if ( a > TWO_PI ) running = false;
  }
  noStroke();
  background( 0 );
  if ( running ) {
    fill(128,255,0);
  } else {
    fill(255,0,0);
  }
  arc( 150,150,200,200, -PI/2, -PI/2 + a);
  fill(0);
  arc( 150,150,150,150, -PI/2, -PI/2 + a+.1 );
  fill(255);
  long rem = time - ( millis() - start );
  if ( running ) {
    int m = floor(rem/60000.0);
    int s = int((rem/60000.0 - m) * 60);
    text(nf(m,2)+":"+nf(s,2),135,150); 
  } else {
    int m = floor(time/60000.0);
    int s = int((time/60000.0 - m) * 60);
    text(nf(m,2)+":"+nf(s,2),135,150);
  }  
}

void mousePressed() {
  if ( !running ) {
    start = millis();
    running = true;
  }
}

@r0x15,

You posted your code (unformatted) with no comments or questions.

You may want to read these:

:)

It is your project and code so you have to decide.

I would replace the inner arc() with a circle() and fill() that.

:)

I need timer this 00:00:00 where possible set allarm and when reached set pin ON

read this