Thursday, September 24, 2020

PWM with Arduino and Pot-meter




PWM (Pulse Width Modulation) 

Here is one more a little Project of PWM using Arduino and pot-meter. In this Project we are creating PWM according to Pot-meter variation. when voltage increase then decrease duty cycle and if voltage decrease then increase duty cycle and when in middle then 50 % duty cycle.

Same article On: PWM using PIC Microcontroller

Here we are sharing Circuit and Code of Arduino

Required Components

  • Arduino Uno
  • Resistor 150 ohm 
  • Pot-meter
  • LED
  • Connecting wires

Circuit diagram:

Arduino Code:

int potPin = 0;

int pinpwm = 12;

int potval = 0;

int t1pwm = 0;

void setup() {

  // put your setup code here, to run once:

pinMode (pinpwm, OUTPUT);

}

void loop() {

  // put your main code here, to run repeatedly:

potval = analogRead(potPin);

t1pwm = 1024-potval;

digitalWrite (pinpwm, HIGH);

delay(t1pwm);

digitalWrite (pinpwm, LOW);

delay(potval);

 }



No comments:
Write comments

I am very thankful for your precious time

Important Artical

Popular Articals

Total Page views in This Month

© 2019-20 Electronics Garage. Designed by Uzma 0101 & Distributed by elektronicsgarage1.blogspot.com