LM393 (Low power dual voltage comparator)

Used Products:

1. Arduino UNO
2. LM393P

Code:

#define pin0Power 9 #define pin1Power 10 void setup() { Serial.begin(9600); pinMode(pin0Power, OUTPUT); pinMode(pin1Power, OUTPUT); } void loop() { int v0 = analogRead(A0); int v1 = analogRead(A1); digitalWrite(pin0Power, v0 < 1000); digitalWrite(pin1Power, v1 < 1000); Serial.print("v0: "); Serial.print(v0); Serial.print(", v1: "); Serial.print(v1); Serial.println(); }