The closest thing I can find is if(Serial) but that only returns true if there's a serial port open.
The function I want, ideally, should:
Return true if plugged into a computer
Return false if plugged into a USB power bank
Return false if not plugged in at all(Running off of its own lithium cell)
VBUSinUSBSTA. – Ignacio Vazquez-Abrams Jul 24 '17 at 17:37if (UDADDR & _BV(ADDEN)) ...– Ignacio Vazquez-Abrams Jul 24 '17 at 22:13