Comparator on Arduino Uno

Thread Starter

Mock10chicken

Joined Oct 20, 2025
16
Hello, does anyone know how to use the Comparator feature on the Arduino Uno? I need to know how to connect everything and how to program it.
 

Thread Starter

Mock10chicken

Joined Oct 20, 2025
16
I am trying to use the built in comparator to detect when a USB-C cable is plugged into a USB-C breakout board. My plan is I connect the CC pins to the D6 pin of my Arduino. I want an LED light to turn on when the cable is plugged into the breakout board and turn off when the cable is removed, so I connect that to D7. The thing I dont understand is where do I connect my reference voltage line, and can I use the Arduino 3v output at the reference. If someone can give me a clear easy to read schematic showing how to do this that would be great
 

Dave Lowther

Joined Sep 8, 2016
332
I don't understand why you need to use a comparator, or even need to use an analog input. Is there a reason why you can't just use a digital input? 0 = no voltage from USB, 1 = voltage from USB.
 
Top