This project sets up a continuously monitored voltage level change at a potentiometer as derived from a source reference. As continuously variable voltage level changes, voltage levels are read into memory from an analogRead operation. From memory, those levels are read and compared to an assigned maximum value (1000). If an increase of voltage is exceeded beyond that value (by potentiometer control), the alarm triggers with a corresponding notice within the serial monitor.
Program & Functional Operation:
This video demonstrates how the code corresponds to the running levels that appear at the Serial Monitor. Notice the code specifies a 1000 limit to the analogRead of the potentiometer level value. Further along in the video, the potentiometer control is rotated to indicate an exceeded level until rotated back below that value again.
Code Setup:
int potVal;
int buzzPin=8;
int potPin=A3;
void setup()
{
Serial.begin(9600);
pinMode(buzzPin,OUTPUT);
pinMode(potPin,INPUT);
}
void loop()
{
potVal=analogRead(potPin);
Serial.println(potVal);
delay(400);
while (potVal>1000)
{
digitalWrite(buzzPin,HIGH);
potVal=analogRead(potPin);
Serial.println(potVal);
delay(400);
Serial.println(“Level Exceeded”);
}
digitalWrite(buzzPin,LOW);
}
Arduino IDE:
Further Project Details: -Paul McWhorter
Comments are closed.