my code for my project is not working PLEASE HELP!!!!

i know ive made mistakes but i dont know what they are. we are making a gate that opens when you snap and doesnt open when there is something in the way the gate also closes itself with a 360 servo which has a spool that with a string t0 bring it back this is our code. our sound sensor isnt getting correct readings and our 360 motor isnt pulling the string back and isnt working it just keeps going PLEASE HELP!!!
int threshold = 17; //Set minimum threshold for LED lit
int sensorvalue = 0;
int maximumRange = 100;
int minimumRange = 0;
long duration, inches;

#include <Servo.h>
Servo lock; // create servo object to control a servo
Servo gate; // a maximum of eight servo objects can be created

void setup()
pinMode(2, OUTPUT);
lock.attach(6); // attaches the servo on pin 9 to the servo object
pinMode(12, OUTPUT);
pinMode(11, INPUT);

void loop()

//gate.write(180); // alosed and locked angles

sensorvalue = analogRead(A0); //Read the analog value
Serial.print("Analog: “);
Serial.println(sensorvalue); //Print the analog value
//Serial.print(” ");
//Serial.print("Digital: ");
//Serial.println(digitalRead(DO)); //Print the digital value

digitalWrite(12, LOW);


digitalWrite(12, HIGH);


digitalWrite(12, LOW);
duration = pulseIn(11, HIGH); // measure the time of flight of sound wave
inches = duration / 74 / 2; // 1130 ft/s * 12in/ft * 1s/1,000,000us = 74 // factor of 2 since sound travels out and back
Serial.println(" inches");

if ((sensorvalue > 100) && (inches > 20))
lock.write(180); //unlocked angle
gate.write(180); //open angle
gate.write(0); //closed angle
delay(1500); //locked angle


Talk to this guy - he's got a very similar problem, a similar aversion to code tags, and, astonishingly, the very same IP address as you

Well funny story we are working together but we still need a lot of help. Could you please help us?

Their threshold is 13, but yours is 17.
Have you explored these possibilities?

we changed it yesterday

What do your debug prints tell you? It seems odd that you haven't posted them

we don't know what that is

What does this

 Serial.print("Analog: ");

tell you?