16-Channel 12-bit PWM/Servo Shield check if it is powered by adapter
I would propose a circuit like the following:







simulate this circuit &ndash; Schematic created using CircuitLab

The voltage divider (consisting of the resistors) will divide the 6V to 5V for the Arduinos digital input. The values are not critical, they can be made higher, but maintain the relationship to still get the 5V. The diode will prevent current to flow from the shield into the voltage divider, when the shield is powered through other means. Now you can simply do a digitalRead() on the corresponding digital input pin of your Arduino, to check, if the power was applied.



Please notice, that the diode will reduce the voltage a little by it's forward voltage (depends on the diode). But that shouldn't be a big problem.