Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't recongnize when charging cable is unplugged #9

Open
phippstech opened this issue Dec 13, 2021 · 1 comment
Open

Doesn't recongnize when charging cable is unplugged #9

phippstech opened this issue Dec 13, 2021 · 1 comment

Comments

@phippstech
Copy link

phippstech commented Dec 13, 2021

I have the code on a custom board of mine (the design is based off the kicad design as well) and everything works for the most part except when I unplugged the device, the LED I have for when the (PD_UFP.get_voltage() == PD_V(20.0) && PD_UFP.get_current() >= PD_A(1.5) is true stays lit when I unplug the USBC cable. Here is the code block I have:

`void loop()
{
//analogWrite(LPWM, 255);
int voltage = analogRead(VBATT);
PD_UFP.run();
if (PD_UFP.is_power_ready())
{

if (PD_UFP.get_voltage() > PD_V(14.0) && PD_UFP.get_current() >= PD_A(1.5)) 
{
   digitalWrite(LED1,HIGH);        
} 
  else
  {
	  digitalWrite(LED1,LOW);
  }

}
}
`

@phippstech
Copy link
Author

So I printed the
PD_UFP.get_voltage() > PD_V(14.0)

and it remains at the same value when the USBC cable is disconnected. Is that suppose to happen or is suppose to go back to zero?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant