2-Digit Up/Down Counter using Arduino

Поделиться
HTML-код
  • Опубликовано: 20 окт 2024

Комментарии • 8

  • @sevketozcelik4794
    @sevketozcelik4794 Год назад

    Display anode or kathode?

  • @almarlagaras
    @almarlagaras 2 года назад

    For basketball 24 seconds shut clock, how to modify the code?

  • @kyo7292
    @kyo7292 2 года назад

    pano nmn sir kung single digit lng yun increment?

  • @garavaa0502
    @garavaa0502 2 года назад

    Text?

  • @s2ngi.official155
    @s2ngi.official155 2 года назад

    wala po bang code?

  • @sobanbaig8700
    @sobanbaig8700 2 года назад

    Sir kindly please give me the code for the 2 digit 7 segment up down Counter using Arduino code please .

    • @creepermin2022
      @creepermin2022 Год назад

      //ID Number
      int cntUp = 23; //Stops counting up when it reaches this value
      int cntDown = 64; //Stops counting down when it reaches this value
      //pin state of the LEDs in the 7 segment display from digits 0-9
      int digit[10] =
      {0b1000000,
      0b1111001,
      0b0100100,
      0b0110000,
      0b0011001,
      0b0010010,
      0b0000010,
      0b1111000,
      0b0000000,
      0b0010000};
      //button controls
      int b1state0 = 1;
      int b2state0 = 1;
      int b1state1, b2state1;
      int b1 = 12;//count down button
      int b2 = 11;//count up button
      //counter controls
      int countstate = cntDown - 1;//initial value
      int ones, tens;
      int spd = 25;//about 0.5 seconds per count
      int rep = spd;
      void setup()
      {
      for (int i = 2; i < 11; i++)
      {
      pinMode(i, OUTPUT);
      }
      pinMode(11, INPUT_PULLUP);
      pinMode(12, INPUT_PULLUP);
      }
      void count(int num)
      {
      for (int i = 2; i 0)
      {
      digitalWrite(9, 0);
      digitalWrite(10, 1);
      count(ones);
      delay(10);
      digitalWrite(9, 1);
      digitalWrite(10, 0);
      count(tens);
      delay(10);
      b1state1 = digitalRead(b1);
      if(b1state1 == 1 && b1state0 == 0)
      {
      b1state0 = b1state1;
      goto countdown;
      }
      b1state0 = b1state1;
      rep = rep - 1;
      }
      rep = spd;
      if(countstate != cntUp)
      {
      countstate = countstate + 1;
      }
      if(countstate > 99)
      {
      countstate = 0;
      }
      }
      countdown:
      while (1 == 1)
      {
      tens = countstate / 10;
      ones = countstate % 10;
      while (rep > 0)
      {
      digitalWrite(9, 0);
      digitalWrite(10, 1);
      count(ones);
      delay(10);
      digitalWrite(9, 1);
      digitalWrite(10, 0);
      count(tens);
      delay(10);
      b2state1 = digitalRead(b2);
      if(b2state1 == 1 && b2state0 == 0)
      {
      b2state0 = b2state1;
      goto countup;
      }
      b2state0 = b2state1;
      rep = rep - 1;
      }
      rep = spd;
      if(countstate != cntDown)
      {
      countstate = countstate - 1;
      }
      if(countstate < 0)
      {
      countstate = 99;
      }
      }
      }

  • @buboyr
    @buboyr 2 года назад

    no code 😉