Arduino Stopwatch

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • Arduino Stopwatch
    In this video we turn an Arduino Nano into a stopwatch using a couple of buttons, a pair of resistors and an OLED display.
    You can download the code here: pastebin.com/R...
    ~-~~-~~~-~~-~
    Please watch: "Diodes: The basic building block of all digital circuits"
    • Diodes: The basic buil...
    ~-~~-~~~-~~-~

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

  • @dominichawkins7997
    @dominichawkins7997 3 года назад

    BOOM works perfect on my uno R3 Thanks':] NW UK

  • @cch_church
    @cch_church 5 лет назад +2

    Can you add the laps time to the code so we can see the time running on the screen.

  • @vaibhavkhurana215
    @vaibhavkhurana215 4 года назад +3

    can u edit the code so that the time is being displayed even when its running pls?

  • @En3rGyFaNforEv3r
    @En3rGyFaNforEv3r 3 года назад

    6:45 420 nice bro

  • @fredlllll
    @fredlllll 7 лет назад +2

    2 buttons to get around debouncing? :P

  • @LhDiy
    @LhDiy 6 лет назад

    Very nice indeed. I have just made my little project like yours, but i have a question: if i push continuously on the stop button, the time is added.
    How can i stop the counting when i do this ?

  • @sugincuk
    @sugincuk 7 лет назад

    cool, does the value of previous timing add up to the next timing?

  • @georgechambers3197
    @georgechambers3197 7 лет назад

    Very nice project. Thanks!

  • @gartmorn
    @gartmorn 7 лет назад

    Great wee project. Wish I could write my own software but not at that stage yet I'm afraid! A clock using ds3231 rtc and a 1602 lcd also on I2C would be great. I could only find one example on youtube but it didn't work for me (or for many others)! It's helping me learn more about coding by seeing your, well thought out, worked examples!

    • @learnelectronics
      @learnelectronics  7 лет назад +1

      Thank you. I don't have an I2C LCD but other than the setup, it would work the same with a different display. In the example below, replace display.print with lcd.print
      /*
      * Arduino Real Time Clock
      * learnelectronics
      * 2 FEB 2017
      *
      * ruclips.net/user/learnelectronics
      */
      // Nokia 5110 pins
      // pin 7 - Serial clock out (SCLK)
      // pin 6 - Serial data out (DIN)
      // pin 5 - Data/Command select (D/C)
      // pin 4 - LCD chip select (CS)
      // pin 3 - LCD reset (RST)
      // DS2321 RTC Pins
      // GND -> GND
      // VCC -> 3.3v
      // SDA -> A4
      // SCL -> A5
      #include
      #include
      #include
      #include
      #include
      Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
      DS3231 Clock;
      bool Century=false;
      bool h12;
      bool PM;
      byte ADay, AHour, AMinute, ASecond, ABits;
      bool ADy, A12h, Apm;
      byte year, month, date, DoW, hour, minute, second;
      void setup() {
      // Start the I2C interface
      Wire.begin();
      // Uncomment the following lines and imput
      // correct data to set time & date
      // Then recomment
      // Clock.setSecond(50);//Set the second
      // Clock.setMinute(10);//Set the minute
      // Clock.setHour(12); //Set the hour
      // Clock.setDoW(4); //Set the day of the week
      // Clock.setDate(1); //Set the date of the month
      // Clock.setMonth(2); //Set the month of the year
      // Clock.setYear(17); //Set the year (Last two digits of the year)
      Serial.begin(9600);
      display.begin();
      display.setContrast(60);
      display.display(); // show splashscreen
      display.clearDisplay(); // clears the screen and buffer
      display.setTextSize(1);
      display.setTextColor(BLACK);
      }
      void ReadDS3231()
      {
      int second,minute,hour,date,month,year,temperature;
      second=Clock.getSecond();
      minute=Clock.getMinute();
      hour=Clock.getHour(h12, PM);
      date=Clock.getDate();
      month=Clock.getMonth(Century);
      year=Clock.getYear();
      temperature=Clock.getTemperature();
      display.setCursor(0,0);
      display.print(hour,DEC);
      display.print(':');
      display.print(minute,DEC);
      display.print(':');
      display.println(second,DEC);
      display.print(month,DEC);
      display.print(",");
      display.print(date,DEC);
      display.print(",");
      display.print("20");
      display.println(year,DEC);
      display.print("Temp. ");
      display.print((temperature)*1.8+32);
      display.print("F");
      display.display();
      display.clearDisplay();
      }
      void loop() {
      ReadDS3231();
      delay(1000);
      }

    • @gartmorn
      @gartmorn 7 лет назад

      learnelectronics thanks Paul your reply is appreciated. Will try this once I finish my in progress projects and let you know how I get on!
      Davy

    • @gartmorn
      @gartmorn 7 лет назад

      BTW will this work ok with my cheap Chinese lcd's? I wondered if they're ok with the adafruit library?

  • @Elitesniper257
    @Elitesniper257 7 лет назад

    Thinking of using this as a speed trap for CO2 powered cars or mousetrap cars since its a lot more precise than just eyeing it. I'll use lasers and maybe some LEDs or photo-resistors as the sensors. What do you think?

    • @learnelectronics
      @learnelectronics  7 лет назад

      That sounds like a cool project. It should work just fine. Let me know how it turns out!

  • @tedjammers
    @tedjammers 7 лет назад

    Question: why is the resistor used in this way rather than only utilizing the yellow wire directly to the board with or without a resistor in series? Thanks!

    • @learnelectronics
      @learnelectronics  7 лет назад

      Tim Kleyn two reasons really. first it keeps the pin low unless the button is pressed. if you didn't do that the pin could read high or low on its own. that's called floating.
      second...if you didn't use the resistor you could overload the pin with current. because pressing the button shorts 5V to ground...the 10k resistor keeps the current low so no damage is done.

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

    what abaut the lcd use matrix dot 8x8 bro i so confuse

  • @Shedir
    @Shedir 6 лет назад +1

    add laps time?

  • @SKElectronics
    @SKElectronics 7 лет назад

    I want you to review stm32f103c8t6 as cheap as a nano but had power like a arduino due so, that will be great for some project and it is also arduino ide compatible.

    • @learnelectronics
      @learnelectronics  7 лет назад +1

      I'm going to contact my friends @ ICStation.com and have them send me one. It sounds like a great idea! Thank you so much.

  • @zzzzzz408
    @zzzzzz408 6 лет назад

    Mine didnt work with my project so i changed the started and the fineshed variables of place and now it works but I dont know why LOL
    if(Retorno1=="Ligado ")// if the led is turned on
    {
    finished = millis();
    delay(200); // for debounce
    displayResult();
    }
    else // if led is turned off
    {
    start = millis();
    delay(200);
    }

  • @MrSasha3050
    @MrSasha3050 5 лет назад

    You should have added current time during the account.

  • @moshekondaveeti8888
    @moshekondaveeti8888 4 года назад

    This code is not working error showing at the adafruit what is the solution

  • @ahmadfirmansyah706
    @ahmadfirmansyah706 4 года назад

    i need coding may u send to me. thanks