digitalWrite() vs analogWrite()
What are differences between digitalWrite() and analogWrite()?
Answer
- digitalWrite() function controls Arduino's pin to LOW or HIGH. Accordingly, We can use this function to turn on/off something such as:
- Turning on/off LED
- Turning on/off Light Bulb
- Turning on/off DC motor
- Turning on/off Solenoid Lock ...
- analogWrite() function generates PWM signal to Arduino's pin. Accordingly, We can use this function to control something such as:
- Controlling the brightness of LED
- Controlling the color of RGB LED
- Controlling the speed of DC motor
- Controlling the angle of Servo motor ...
See more in function references:
Buy Arduino
1 × Arduino UNO Buy on Amazon | |
1 × USB 2.0 cable type A/B Buy on Amazon | |
1 × Jumper Wires Buy on Amazon |
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables.
Additionally, some links direct to products from our own brand, DIYables.