2/25/2020
Serial.println("Cannot connect to STUSB4500.");
Serial.println("Is the board connected? Is the device ID correct?");
while(1);
}
Serial.println("Connected to STUSB4500!");
delay(100);
float voltage, current;
byte lowerTolerance, upperTolerance, pdoNumber;
pdoNumber = usb.getPdoNumber();
voltage = usb.getVoltage(3);
current = usb.getCurrent(3);
lowerTolerance = usb.getLowerVoltageLimit(3);
upperTolerance = usb.getUpperVoltageLimit(3);
/* Since we're going to change PDO3, we'll make sure that the
STUSB4500 tries PDO3 by setting PDO3 to the highest priority. */
usb.setPdoNumber(3);
/* PDO3
- Voltage 5-20V
- Current value for PDO3 0-5A, if 0 used, FLEX_I value is used
- Under Voltage Lock Out (setUnderVoltageLimit) 5-20%
- Over Voltage Lock Out (setUpperVoltageLimit) 5-20%
*/
usb.setVoltage(3,15.0);
usb.setCurrent(3,0.5);
usb.setLowerVoltageLimit(3,20);
usb.setUpperVoltageLimit(3,20);
/*Write and save settings to STUSB4500*/
usb.write();
/*Read settings saved to STUSB4500*/
usb.read();
Serial.println();
/*Print old setting*/
Serial.println("Original Values:");
Serial.print("PDO Number: ");
Serial.println(pdoNumber);
Serial.print("Voltage3 (V): ");
Serial.println(voltage);
Serial.print("Current3 (A): ");
Serial.println(current);
Serial.print("Lower Voltage Tolerance3 (%): ");
https://learn.sparkfun.com/tutorials/power-delivery-board---usb-c-qwiic-hookup-guide?_ga=2.178703713.438471343.1582643437-1178948360.158...
Power Delivery Board - USB-C (Qwiic) Hookup Guide - learn.sparkfun.com
20/23
Need help?
Do you have a question about the Power Delivery Board - USB-C (Qwiic) and is the answer not in the manual?
Questions and answers