M5stickC turn on when connect Type-C USB with power (How to disable?)
-
When I plugin Type-C USB with power, M5stickC will turn on automatically. Is it possible to disable?
-
Hello @sgnp2091
do you mean disable by software or hardware?
The way M5StickC Plus is wired internally I don't think it is possible to disable this functionality by software, but I guess it would be possible by a hardware modification.
Thanks
Felix -
I would like to disable this function by Arduino. I don't want to modify the hardware. Btw, thank you for your reply.
-
Don't know if still relevant, but you can just power it off if you see it was plugged in.
I attach a basic code here, and you can tweak it to your needs of course.Be aware that you might need to use a small delay before M5.Axp.GetVBusVoltage() will give you a result you can trust.
//function which reads the voltage coming out of the USB, and if it's above 4.1 I know the device is being charged.
bool isBeingCharged()
{
float charge = M5.Axp.GetVBusVoltage();
//Serial.println(charge);
return charge > 4.1;
}//check here of anywhere you want in the code if the device is being charged, and power it off.
void setup()
{
if (isBeingCharged())
{
M5.Axp.PowerOff();
}
}