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 |
Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.