Since SDK 2.4.0 there is a way to receive messages via the serial port msg command, but do you plan to implement a way to send messages?
It's as simple as print()
Yes, obviously. Thanks!
So, possibly a dumb question, but:
If two playdates are connected by USB, does that mean they can communicate with a combination of print()
and serialMessageReceived()
?
If not, I am going to put in a request for this. Especially with the addition of wifi (indicating a lower degree of concern about device security), playdate-playdate over usb-C seems like a no-brainer, barring some technical obstacle.
You actually can't do this since the Playdate can't act as a USB host, just a device. I think it's a limitation of the hardware, but don't quote me on that.
Hmm, I'm out of my depth here, but I kindof doubt it would be a hardware limitation, since USB-C is so flexible. Here is Playdate's USB controller (according to this teardown of an early unit). It supports dual-role port mode, which I believe means that it can switch from essentially device to host.
Maybe someone with more knowledge could look at the teardown to see if the controller is properly wired for dual-role port mode.
Maybe one way of testing this would be using a USB-C to USB-A(female) + USB-A(male) to USB-C adaptor. I'm pretty sure that forces the female-side USB-C to act as a power source (because USB-A(male) to USB-C is mono-directional I believe), not sure if it also forces it to act as a host.
You are correct that the component is capable of it. However, in order to be a USB host, it needs to provide the power for the USB connection. I'm not 100% sure if its a firmware choice or whether there is a diode on the board. But the playdate can only receive power, never give it. Both Funny OS and IndexOS (Custom operating systems for the playdate) haven't been able to get access to this either.
- Thanks for the informative explanation! If Index OS and Funny OS haven't figured it out, I guess I won't either. From reading other posts, it sounds like even though the host-device dichotomy is a little more complex in USB-C, at least one side has to be a power source.
- It sounds like I need to be on the playdatesquad discord if I want to know more about weird stuff like this (because the pages for Funny OS and IndexOS both reference the discord).
- Ugh, it sounds like any link between two playdates would require a custom cable, including a PC or microcontroller for USB-C to USB-C. I want to write a library for linking over a 3.5mm cable setup (by cross wiring two splitter cables), but it seems pointless since few people would actually construct a cable like that themselves.
I wanted to do this too. but came to the same conclusion. Also, not that many playdates in the wild that people would reasonably encounter a person to 'trade/share' over link cable with.
I actually ended up spending the day messing around with Crankster's PDUSB library. I had Gemini convert it to Python (since I know a little bit of python), and it looks like it would be possible to have multiplayer over USB-C with a computer in the middle.
More importantly, it looks like it would be possible to have multiplayer over USB-C with a computer in the middle only running a website, with no additional dependencies (using web serial).
I'm going to try a basic Python setup sometime this month. I'm thinking of a Zelda:four swords style setup where one playdate runs the game and the other takes its mirrored screen contents and sends back inputs. The web serial stuff would need to be left to someone else, in any case.
Yeah this already exists. It's called pdportal! Made by @paulstraw I believe!
https://pdportal.net/
We're about to use it on quite a large scale for the playdate community awards with the app Clap-Along which allows for live reactions to the awards with your playdate!
Very cool! I just spent the last few days making my own version (for local multiplayer) that has some differences from pdport. Posting it momentarily.