Turn off charging from USB

Is there a way to turn off the charging through the USB port. I would like to monitor my application (via serial) for low battery conditions but if I have it plugged in, it is charging the battery.

I guess you are talking about an Electron, right?

Documentation is sparse but the functions are available and the source code is open to look at.

1 Like

What do you think would happen if USB pins were exposed to (salt) water like they are on sport watches (like a Garmin or Suunto GPS watch, for example) when not connected to external USB? All pins (VBUS, GND, USB+, USB-) would obviously be shorted when submerged which, on the surface, seems benign as there shouldn’t be an voltage differentials to begin with, but the smallest potential differences across any of those pins would cause current to flow and electrochemical corrosion. Looking at your links as well as https://github.com/particle-iot/firmware/blob/ff55f2d32cd41b7086f0031bb23faf2d854f12a2/wiring/src/spark_wiring_usbserial.cpp doesn’t make it look like you can pull all of the pins down to 0 V in firmware, which would eliminate any possible potential differences, but maybe that’s unnecessary anyway… I realize this is a sort of weird question but wonder if you or any community members might know how this would go (before I fry any of my hardware trying to learn the expensive way…).