Connection to a computer #6795
Replies: 1 comment
-
Posted at 2024-11-12 by @fanoush good question, some time ago I did not find a way, so I added it myself to E object in
it worked for me at least in STM32 build, I used it like this to start console on serial when USB was not connected 3 seconds after poweron.
I think So maybe something like E.isUSBConnected() could be added if it is not already there? I did not find better place than E, it could be property of USB object itself but that is instance of Serial and I don't know how to do it just for USB and not other Serial instances. Posted at 2024-11-13 by @gfwilliams
Yes, that's true, or if you force it with So right now I don't think we have a way, except to alter the code as @fanoush has done. IMO a Serial.isConnected might be quite good. It would be handy for Bluetooth, but also for Serial1/etc it could still return true/false depending on whether they've been set up. What board are you using @Markbloom? Is it your own custom one? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2024-11-12 by MarkBloom
Is there a way to check if Espruino is connected to a computer via USB besides something like that?
I'd like my program to have a different behaviour depending on that factor.
Beta Was this translation helpful? Give feedback.
All reactions