const int potPin = A0; // Potensiometrning analog pin raqami
const int ledPin = 9; // LED chirog‘ining pin raqami
void setup() {
pinMode(ledPin, OUTPUT); // LED chirog‘ini chiqish sifatida sozlash
}
void loop() {
int potValue = analogRead(potPin); // Potensiometrning qiymatini o‘qish
int brightness = map(potValue, 0, 1023, 0, 255); // Qiymatni 0 dan 1023 gacha bo‘lgan oraliqdagi tartibga keltirish
analogWrite(ledPin, brightness); // LED chirog‘ini o'zgartirish
}