PWM With Arduino - Step by Step Guide
Intro: PWM With Arduino - Step by Step Guide
Small step by step guide on how to use the PWM (Pulse Width Modulation) of the Arduino board. The video includes the components needed and an easy to follow connection guide, as well as a demo of the results obtained. The code is also included. Try it out yourself, enjoy! :D
11 Comments
debrat.pranay 6 years ago
In this video i will describe how to generate PWM signal from arduino uno that means generate variable output voltage from digital device. Because variable voltage is essential for speed control of dc motor and angular position control of servo motor.
In arduino six pin 3,5,6,9,10,11 used for pwm. PWM means analog signal in digital form. https://youtu.be/82SfYWhw6fA
jessey 8 years ago
Hi, anyone know what type or value the pot is for this?
saarp18 10 years ago
Have you heard about them?
Veda88 10 years ago
jgrecoarroyo 10 years ago
pratyadi 10 years ago
http://www.linuxcircle.com/?p=640
You do not need servo.h library
rclear 11 years ago
Will you specify what transistor you were using?
alien200049655 12 years ago
jgrecoarroyo 12 years ago
And here the code itself:
int motor = 9;
int potenciometer = 5;
void setup(){
pinMode(9,OUTPUT);
pinMode(5,INPUT);
Serial.begin(9600);
}
void loop(){
int value = analogRead(potenciometer);
//read input value: range between (0,1023)
int motor_speed = value/4;
//PWM can only ouput 255 different values
analogWrite(motor,motor_speed);
Serial.println(motor_speed);//for testing purposes
}
agreco5 12 years ago
jgrecoarroyo 12 years ago