0% found this document useful (0 votes)
33 views1 page

Pert4 Iot

The document defines variables for an analog pin connected to a potentiometer, two PWM pins connected to LEDs, and a variable to store the potentiometer reading. It sets the LED pins as outputs, reads the potentiometer and uses its value to set the brightness of the LEDs using PWM.

Uploaded by

Brend vin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Pert4 Iot

The document defines variables for an analog pin connected to a potentiometer, two PWM pins connected to LEDs, and a variable to store the potentiometer reading. It sets the LED pins as outputs, reads the potentiometer and uses its value to set the brightness of the LEDs using PWM.

Uploaded by

Brend vin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

int potPin = A0;

int nilai_PWM = 0;
int ledPin = 11;
int ledPin2 = 10;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ledPin2,OUTPUT);
}

void loop() {

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


nilai_PWM = analogRead(potPin);

analogWrite(ledPin,nilai_PWM/4);
analogWrite(ledPin2,nilai_PWM/4);
delay(20);
Serial.print(nilai_PWM);
Serial.println();
}

You might also like