void setup() {
  // put your setup code here, to run once:
 pinMode(A0, INPUT);
 pinMode(2, OUTPUT);

 Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
int analogValue = analogRead(A0);

if(analogValue < 300)
{
  digitalWrite(2, HIGH);
}else
{
  digitalWrite(2, LOW);
}


Serial.println(analogValue);
delay(100);
}