Tekko BDSimSimulatorProjects

নব দিয়ে আলো কমানো-বাড়ানো (analog + PWM)Potentiometer Arduino

নব ঘোরালে A0 এর voltage বদলায় (0–1023); map() সেটা 0–255 করে আর pin 9 এ analogWrite দিয়ে LED এর আলো ঠিক করে।

Turning the knob changes the voltage on A0 (0–1023); map() scales it to 0–255 and analogWrite on pin 9 sets the LED brightness.

▶ ফ্রি চালিয়ে দেখো / Run it free Parts অর্ডার করো (WhatsApp)

যা যা লাগবে · Parts you need

তার লাগানো · Wiring

Arduino Uno 5V→Knob (potentiometer) 1
Knob (potentiometer) 2→Arduino Uno GND
Knob (potentiometer) W→Arduino Uno A0
Arduino Uno D9→Resistor a
Resistor b→LED A
LED K→Arduino Uno GND.3

Code (Arduino C++)

// Turn the knob to change the LED brightness
void setup() {
  pinMode(9, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int value = analogRead(A0);              // 0 .. 1023
  int brightness = map(value, 0, 1023, 0, 255);
  analogWrite(9, brightness);              // PWM pin ~9
  Serial.println(value);
  delay(50);
}

ভিডিও · Videos

arduino bangla basic tutorial -11 || control LED with potentiometerControlling LED Brightness by Potentiometer With Arduino

আরো project · More projects