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
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.