Professional Documents
Culture Documents
Activity 4 Potentiometer and Turn On The LED If The Value Is Beyond Thresold
Activity 4 Potentiometer and Turn On The LED If The Value Is Beyond Thresold
Name:Rajnikant hirapara
Enroll No: 92200133013
Circuit diagram
Bachelor of Technology
Information and Communication Technology
Basics of Electronics Engineering (01EC0101)
Code
const int analogPin = A0;
const int ledPin = 3;
const int threshold = 400;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int analogValue = analogRead (analogPin);
if (analogValue > threshold)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
Bachelor of Technology
Information and Communication Technology
Basics of Electronics Engineering (01EC0101)
}
Serial.println(analogValue);
delay(10);
}