FADING LED ON BREADBOARD WITH PWM - Arduino tutorial #3

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ค. 2024
  • In this Arduino for beginners tutorial I teach you how to fade an LED using the PWM (Pulse Width Modulation) technique. Code arduino-tutorials.net/tutoria...
    The resistor calculator: www.allaboutcircuits.com/tool...
    PWM (Pulse Width Modulation) is a technique which can be used to fade a LED. In this tutorial I explain with some examples how PWM works. We end with creating the code to actually fade a LED on a breadboard.
    The Arduino for beginners tutorials series guides you through the world of Arduino. A video is around 10 minutes and shows you step-by-step how to build the circuit and write the code. The website contains the course material, circuit diagram, Arduino code and shopping list of all the components used in the tutorial.
    👉 More tutorials and projects on arduino-tutorials.net
    🇳🇱 Bekijk deze tutorial in het Nederlands op • 🇳🇱 FADENDE LED OP BREA...
    📺 NEXT: Potentiometer controlling blinking interval of LED
    • POTENTIOMETER CONTROLL...
    🇨🇳 Arduino Uno (clone)
    arduino-tutorials.net/r/KnSgtg
    🇳🇱 Arduino Uno (clone)
    arduino-tutorials.net/r/8237Hd
    🇳🇱 Arduino Uno SMD (original)
    arduino-tutorials.net/r/Ud29dh
    🇳🇱 Arduino Uno Chip (original)
    arduino-tutorials.net/r/Jd82ha
    🇨🇳 300x assorted LEDs
    arduino-tutorials.net/r/dvQO6t
    🇳🇱 100x LEDs (5 colors)
    arduino-tutorials.net/r/823Dhs
    🇨🇳 3x breadboard
    arduino-tutorials.net/r/k8rZRv
    🇳🇱 1x breadboard small
    arduino-tutorials.net/r/238Jds
    🇨🇳 1x breadboard large
    arduino-tutorials.net/r/ZnW9L4
    🇳🇱 1x breadboard large
    arduino-tutorials.net/r/8237Dh
    🇨🇳 2000x Resistors
    arduino-tutorials.net/r/FHHA69
    🇳🇱 Jumper wire male-male
    arduino-tutorials.net/r/8237Jd
    🇨🇳 Jumper wire male-male
    arduino-tutorials.net/r/pkoGV4
    CHAPTERS:
    00:08 Requirements
    00:35 PWM (Pulse Width Modulation)
    01:52 Building the circuit
    03:05 Arduino code
    05:04 Working project
    #arduino #BasOnTech

ความคิดเห็น • 18

  • @CharltonAigbekaen1711
    @CharltonAigbekaen1711 3 ปีที่แล้ว +1

    am impress new to this and learning fast

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว

      Great to hear! 😃

  • @kwabzmahle9016
    @kwabzmahle9016 ปีที่แล้ว

    Thanks for the helpful videos.
    On the Arduino IDE, why does the LED only fade when I type 'analogWrite' and not when I type 'digitalWrite'?

    • @BasonTech
      @BasonTech  ปีที่แล้ว +1

      Hi, digitalWrite() can only write 2 values: HIGH and LOW. Therefore the LED can be On or Off. analogWrite() is able to write 1024 different values so the LED can have 1024 different brightness levels which we se as fading.

    • @kwabzmahle9016
      @kwabzmahle9016 ปีที่แล้ว

      @@BasonTech Wow. Thanks.

  • @reshairo
    @reshairo 3 ปีที่แล้ว +1

    Im new to arduino & for your channel. Greate tutorial. Still watching from #1.
    I have 1 question, in the beginning you said in digital pins can deliver 1 & 0 only then how led dimmer works with digital pins (im assuming dimming is analog). Again i want to remind you im new to arduino 😉

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว +1

      Hi, interesting question! A LED dimmer can work multiple ways see blog.visual.electro-matic.com/how-do-led-dimmers-work But if I understand correctly you make LED blink very fast and that simulates the dimming 😃

    • @reshairo
      @reshairo 3 ปีที่แล้ว +1

      @@BasonTech noted with many thanks

  • @prithvimellacheruvu6378
    @prithvimellacheruvu6378 ปีที่แล้ว

    Hey, I wanna do the same experiment but using 2 leds. When one fades out, the other must fade in. Any tips wrt code?

    • @BasonTech
      @BasonTech  ปีที่แล้ว

      With this tutorial you should be able to make this 😃 This trick is to invert the value of the 2nd LED with the 1st one

  • @kiwinesss
    @kiwinesss 3 ปีที่แล้ว

    Done ... I have to do more with the "for" function. I didn't really quite get it completely.

    • @BasonTech
      @BasonTech  3 ปีที่แล้ว +2

      For loops are not the easiest part of programming. However what could help is to make some on your own. For example:
      - a loop that goes from 0 to 10
      - a loop that goes from 5 to 10
      - a loop that goes from 5 to -5
      - a loop that goes from 2, 4, 6, till 10
      - a loop that goes from 1, 5, 10 till 20
      Good luck! 😃

    • @kiwinesss
      @kiwinesss 3 ปีที่แล้ว

      @@BasonTech Super idea, thanks, I will do it now.

  • @nadenglish3811
    @nadenglish3811 9 หลายเดือนก่อน

    How to make it stay on after it glows gradually, while keeping in mind it has to gradually fade out when the LDR value is up

    • @BasonTech
      @BasonTech  8 หลายเดือนก่อน

      On what part are you getting stuck?

  • @raymondmichael4987
    @raymondmichael4987 2 ปีที่แล้ว

    How can we avoid those delays!? As they stalls the mc

    • @BasonTech
      @BasonTech  ปีที่แล้ว

      You can using millis() This is an advanced topic but I describe it in arduino-tutorials.net/project/digital-arduino-clock

  • @joeborovina4769
    @joeborovina4769 4 หลายเดือนก่อน

    #3TY!