Tutorial: How to use millis | Goodbye delay, Hello millis

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

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

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

    Galing kabayan thanks!! Keep up the great work!

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

    Very helpful, thanks.

  • @zumzy666
    @zumzy666 4 года назад +1

    what if u want to blink the led in a SOS pattern (short, short, short, long, long, long, short, short, short) and use a button to toggle the SOS pattern on and press again to toggle SOS pattern off while using millis

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

      Hi zumzy666, just replying for the sake of others who might stumble here, I know you already see this :) ruclips.net/video/WujRf5Dha7w/видео.html

    • @martinkuliza
      @martinkuliza 11 месяцев назад

      First you should consider MORSE CODE TIMING PROTOCOL
      Dots and Dashes PART OF THE SAME LETTER - 1 Second between each
      DISTANCE BETWEEN LETTERS - 3 Seconds, then revert to Point 1
      DISTANCE BETWEEN WORDS - 7 Seconds, then revert to Point1 and Point 2
      Now use that to time your millis

  • @RameshKumar-rt8xb
    @RameshKumar-rt8xb 3 года назад +1

    But how are they turning off automatically even though you didn't mention them to turn off after some interval?

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

      @Ramesh Kumar, that was achieve by toggling the state of the pin. For example:
      // toggle LED state
      ledState_YEL = !ledState_YEL;
      The exclamation mark "!" is a logic NOT which toggles or inverts the state of the pin. If it is currently 1, it will become 0. If it os currently 0, it will become 1.

    • @RameshKumar-rt8xb
      @RameshKumar-rt8xb 3 года назад +1

      @@TechToTinker Yes thank you.

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

      @Ramesh Kumar, you're welcome. Thanks.

    • @RameshKumar-rt8xb
      @RameshKumar-rt8xb 3 года назад

      @@TechToTinker Hello I'm using blynk to achieve this where the delay function is restricted. Can you tell me how to use simpletimer library with blynk application?

  • @youloveelectronix4902
    @youloveelectronix4902 4 года назад +1

    Teach something about using vga interfacing to any tft displays using stm32f40x series.

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

      @saurav, as of now, tft interfacing is possible but with VGA I think its impossible. I could be wrong but with the number of VGA pins, I would say use FPGA instead for efficiency.

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

    You good programmer!

  • @jephew1441
    @jephew1441 4 года назад +1

    Salamat po, Sir. Makakatulong po itong idea na ito para sa project namin na may SIM800L. Home Security System po kasi yung project namin. Kaso nahihirapan kaming pagsabayin ung receive at send ng alert ng SIM800L. Iniisip ko po kung makakatulong ito or may iba pang mas tamang way. Ito po ba ay pwede kong maimplement doon?

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

      Hi JepDev, thank you for visiting. Yes this is one way to achieve mutitasking (doing multiple task at almost the same time). You need a little modifications to the source code provided and adapt it for your goal in the project.

  • @youloveelectronix4902
    @youloveelectronix4902 4 года назад +1

    Please make more videos related using thonny python on esp32 or stm32 rendering use of tft (7inch- 9inch)lcd displays and cam modules

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

      Hi @saurav, thank you for your suggestion. I will take note of this.

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

    Using millis how would you make the LED start off? It seems that the led must start on?? Thanks George. New subscriber!!!

    • @martinkuliza
      @martinkuliza 11 месяцев назад

      The L.E.D. is OFF before the system starts,
      therefore it does start OFF
      on the off chance that the last state is on
      it checks with IF what the state of it is

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

    Could you please help me out on topics covering lvds or ttl cmos related tft driver boards making use of vga or hdmi interfacing.

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

      Hello @Saurav Anand, as for now, LVDS or VGA is impossible to accomplish using microcontrollers. Try FPGA and Im sure it possible.

  • @elzjonz
    @elzjonz 3 года назад +1

    Sir pwede pa example ng may switch button or something na sensor magtitrigger for each led? Thanks

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

      Hi @jon else, you mean like this one right? ruclips.net/video/ylLiFOdPCWQ/видео.html

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

      @@TechToTinker sir hehe thanks sir pero medyo complicated na tingnan kasi may lcd display na.. Hehe simple lang po sana kasi ang gagawin ko po, 2 ultrasonic sensor na handwash using 1 board.. Tapos pag delay kasi ang gamit hindi magagamit ng sabay ang dalawang handwash kaya millis ang solution pero inaaral ko pa, or naghahanap ako ng code nalang hehe thanks good day 😊

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

      @@elzjonz oic. As a start, ganito gawin mo sa main loop:
      1. Check if sensor 1 is triggered, set a flag lets say sensor1 = True
      2. Same for sensor 2
      3. if sensor1 is true, run pump1 and sensor1= False
      4. same for sensor2
      Hope this could help you.

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

      5. Turn ON pump1 and use millis counter to turn it OFF later on.
      6. Same for pump2

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

      @@TechToTinker sir ok sir susubukan ko pgmakabalik ng bundok hehe weekly din kasi uwian doon kasi nagtuturo si misis ishare share ko lang din ang knowledge para ma inspire ang mga studyante doon hehe thanks sir more power sa channel nyo po 😊

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

    Sr. please make the code bellow becomes millis:
    Void loop () {
    if (digitaRead (tombol)==0){
    digitalWrite (led, HIGH);
    delay (3000);
    digitalWrite (led, LOW);
    delay (3000);
    digitalWrite (led, HIGH);
    delay (3000);
    digitalWrite (led, HIGH);
    delay (3000);
    }
    else {
    digitalWrite (led, LOW);
    }
    }
    How to be version millis Sr..???.,...

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

      lol no

    • @martinkuliza
      @martinkuliza 11 месяцев назад

      @@panelty8379
      LOL.... Agreed,
      there's nothing to show utter laziness like saying
      Here is a blink sketch
      convert it to millis
      LOL

    • @martinkuliza
      @martinkuliza 11 месяцев назад +1

      ALSO FORMAT YOUR CODE BETTER ........LIKE THIS
      void loop ()
      {
      if (digitaRead (tombol)==0)
      {
      digitalWrite (led, HIGH);
      delay (3000);
      digitalWrite (led, LOW);
      delay (3000);
      digitalWrite (led, HIGH);
      delay (3000);
      digitalWrite (led, HIGH);
      delay (3000);
      }
      else
      {
      digitalWrite (led, LOW);
      }
      }
      This makes Debugging sooooo much easier
      FYI void does not have upper case V
      and if you're keen you can make it even easier by doing this
      void loop ()
      { // OPENS void loop Function
      if (digitaRead (tombol)==0)
      { // OPENS IF Statement 1
      digitalWrite (led, HIGH);
      delay (3000);
      digitalWrite (led, LOW);
      delay (3000);
      digitalWrite (led, HIGH);
      delay (3000);
      digitalWrite (led, HIGH);
      delay (3000);
      }
      else
      {
      digitalWrite (led, LOW);
      }// CLOSES IF Statement 1
      } // CLOSES void loop Function
      If you get in the habit of doing this
      1. You'll never look for lost braces again
      2. You will never have unbalanced braces again
      3. and if you do, it will take you seconds to work it out
      GOOD FORMATTING IS IMPORTANT

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

    Please make any tutorials on camera module interfacing and tft display interfacing with stm32f407vgt6.

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

      Good idea, maybe in the future. Thank you for the suggestion

  • @asaresallent.2850
    @asaresallent.2850 3 года назад

    What the heck hahaha