LM311P (Voltage Comparator)

used products:

1. Arduino UNO
2. LM311P

Arduino:

#define pinPower 9 void setup() { Serial.begin(9600); pinMode(pinPower, OUTPUT); } void loop() { int v = analogRead(A0); Serial.print("v: "); Serial.print(v); digitalWrite(pinPower, v < 1000); Serial.println(); }