int pwmPin = 0;
int analogInPin = A1;
int cutoff = 1;
void setup() {
// put your setup code here, to run once:
pinMode(pwmPin, OUTPUT);
pinMode(analogInPin, INPUT);
pinMode(cutoff, INPUT);
}
void loop() {
int CutoffValue = (digitalRead(cutoff));
if(CutoffValue == LOW){
int analogIn = analogRead(analogInPin);
if (analogIn > 400){ digitalWrite(pwmPin,HIGH); }
else{ digitalWrite(pwmPin,LOW);}
// analogWrite(pwmPin, analogIn / 4);
}
else
digitalWrite(pwmPin,LOW);
}