// the setup routine runs once when you press reset:
void setup() {
analogRefrence(DEFAULT); // Set VR+ = VCC:3.6B, VR- = GND:0V as the upper and the lower limits
pinMode(3,OUTPUT); // set the buzzer pin mode
}
// the loop routine runs over and over again forever:
void loop() {
// read the analog voltage at A0
int sensorValue = analogRead(A0);
// convert the ADC reading to voltage
float voltage = sensorValue * (3.6 / 1023);
if (voltage < 3.0) {
// tripwire is cut: activate the buzzer with oscillation
digitalWrite(3,HIGH);
delay(150);
digitalWrite(3,LOW);
delay(100);
}
else {
// tripwire is not cut: de-activate the buzzer
digitalWrite(3,LOW);
}