Untitled
unknown
plain_text
a year ago
487 B
6
Indexable
#define LED_PIN 11
#define POTENTIOMETER_PIN A1
int Delay = 1000;
void setup()
{
pinMode(LED_PIN, OUTPUT);
pinMode(POTENTIOMETER_PIN, INPUT);
Serial.begin(9600);
}
void loop()
{
int potentiometerValue = analogRead(POTENTIOMETER_PIN);
Serial.println(potentiometerValue);
delay(Delay);
// conversion from int value to byte value
int brightness = potentiometerValue / 4; (or)
pinValue=(255.0/1023.0)* potentiometerValue;
analogWrite(LED_PIN, brightness);
}
Editor is loading...
Leave a Comment