use analogread as for a switch

I am trying to apply 5v to a piezio buzzer when(if) the voltage going into the analog input drops below 5v, how would I program the arduino to do that?

I will be adding it to this code

/***************************************************
This is an example sketch for our optical Fingerprint sensor

Designed specifically to work with the Adafruit BMP085 Breakout
----> http://www.adafruit.com/products/751

These displays use TTL Serial to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution

Code modified and Project Built By Carrigan Luneke
****************************************************/

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

int getFingerprintIDez();

// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
Serial.begin(9600);
Serial.println(“fingertest”);
pinMode(11, OUTPUT); //Red LED
pinMode(12, OUTPUT); //Green LED
pinMode(10, OUTPUT); //Garage Bridge

// set the data rate for the sensor serial port
finger.begin(57600);

if (finger.verifyPassword()) {
Serial.println(“Found fingerprint sensor!”);
} else {
Serial.println(“Did not find fingerprint sensor :(”);
while (1);
}
Serial.println(“Waiting for valid finger…”);
}

void loop() // run over and over again
{
getFingerprintIDez();
digitalWrite(11, HIGH); // Red LED ON
digitalWrite(12, LOW); // Green LED OFF
digitalWrite(10, LOW); //Garage opener not Active
}

uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image taken”);
break;
case FINGERPRINT_NOFINGER:
Serial.println(“No finger detected”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println(“Imaging error”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK success!

p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image converted”);
break;
case FINGERPRINT_IMAGEMESS:
Serial.println(“Image too messy”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println(“Could not find fingerprint features”);
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println(“Could not find fingerprint features”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println(“Found a print match!”);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println(“Communication error”);
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println(“Did not find a match”);
return p;
} else {
Serial.println(“Unknown error”);
return p;
}

// found a match!
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;

p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;

// found a match!
digitalWrite(11, LOW); //Red LED OFF
digitalWrite(12, HIGH); //Green LED ON
digitalWrite(10, HIGH); //Garage Opener Active
delay(1000); //Applies 0v for one second, may be different for each opener
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

I am trying to apply 5v to a piezio buzzer when(if) the voltage going into the analog input drops below 5v

The input to the analogue pin had better not go above 5V or you may fry your Arduino. What range of voltages do you plan to apply to the pin ? If it is greater than 5V you could use a voltage divider to scale the input into the 0 to 5V range then do an analogRead() and calculate the voltage. You will get a value of 0 for 0V input, 1023 for an input of 5V and all values in between in proportion to the voltage.

You can also use digitalRead() and digitalWrite() on analog pins.

//Wire a switch between GND and Analog 0 (zero)
#define INPUT_SWITCH_PIN A0
//use the builtin LED on pin 13 as an indicator
#define OUTPUT_LED 13

void setup() {
  pinMode(INPUT_SWITCH_PIN, INPUT_PULLUP);
  pinMode(OUTPUT_LED, OUTPUT);
}
void loop() {
  boolean IsPressed;
  IsPressed = !digitalRead(INPUT_SWITCH_PIN);  //active-low switch, inverted with !
  digitalWrite(OUTPUT_LED, IsPressed);
}