-
Notifications
You must be signed in to change notification settings - Fork 81
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
Linux version of scratch-link? #84
Comments
Hey @martinohanlon, just to follow-up on this thread from our email discussion:
|
Hi, After some quick examination it seems that scrach-link is a flat web server @device-manager.scratch.mit.edu:20110 with websocket capability which handles json requests as described in Network Protocol. json requests for bt/ble are quite simple:
I propose to create scratch-link version for linux as SysV service starting at init which reroutes device-manager.scratch.mit.edu to localhost. It can be implemented in python using flask with websockets or any other simple http-service. For other than bt/ble services eg. tcp pigpiod daemon @ raspberry, scratch-link should just redirect the queries as necessary. |
I don't know how the Windows and MacOS versions are implemented, but I think this is very similar to the http-serial-BT bridge developed by MakeBlock for the MBot (like an Arduino) It is a node.js app which is used by their version of Scratch to send data via the serial port to the device which is running a particular sketch with a compatible protocol. I've created a github project here if anybody is curious https://github.com/audetto/mblock-mlink. The good thing about this approach is that the same node.js version works for all platforms and you don't need to maintain a separate source for each of them. How to create the serial port, is OS-specific, but afterwards the same code works for Win, Mac, USB, BT... |
https://github.com/audetto/asi-link I've written a super simple implementation in nodejs of a link for serial ports (USB or BT Classic), which should work on all platforms. I might be completely off, but it looks super simple, with a few caveats
|
My bad, it was a side effect of a poor design (global variables...) |
@audetto I've just created #137 as a place to discuss WSS rationale and related topics. You're not the first person to ask about it so I figured it was time for a thorough explanation to be posted somewhere. If you'd like to further discuss other topics related to the protocol or serial ports or anything that isn't specifically related to building a Linux version of Scratch Link, I would recommend creating a separate issue for that discussion. Thanks! |
+1 for the linux port... It would be great because my kids could use a rpi for programming boost... |
Mind you, scratch link linux for a serial device is pretty much done (either USB or Bluetooth Classic) Lego Boost needs BLE UART which is not written. There is a node.js module for this https://github.com/noble/noble I will have to try it. |
Two years ago I wrote a multi-platform micro:bit extension for ScratchX using noble. I'm still waiting for the official Scratch Link for Linx, Raspberry PI and Chromebook version. |
+1 for Linux (esp. RPI) |
@thisandagain A Japanese programmer wrote Python implementation of Scratch Link here: https://github.com/kawasaki/bluepy-scratch-link/blob/master/scratch_link.py |
@apple502j Thanks for the heads-up! I hadn't seen this yet! |
Can we use a cross-platform language to re-write this tools? like Java, Python ... |
do you have copy i can install??? |
Hi Peter |
i try the go lang and java ,but it's difficult to implement. but i found a idea - Web Bluetooth. who use it? like MakeCode |
I tried using pyscrlink and it worked well. (repo: https://github.com/kawasaki/pyscrlink) |
It turns out that this was renamed to pyscrlink |
Is there any updated on Linux support? |
I have written scratch-link in Node.js for Linux and Intelino smart train: https://github.com/zdila/intelino-smart-train-scratch-link-linux Code is quick and dirty (written in cca one day including studying of D-BUS and it's Bluetooth API) and it is hardcoded to search only Intelino devices. Feel free to use it for the inspiration. |
+1 for official Linux support. I'm using Scratch 3.0 and kawasaki/pyscrlink on Linux (Ubuntu). I confirm that is stable and works fine with Lego WeDo 2.0 and EV3. I also tried zdila/scratch-link-ble-linux. I was able to connect a WeDO 2.0 but could only use the "set light color to" command. I will continue to try it, because it is new and under development. |
This issue is meant to be a way of opening a discussion relating to the creation a linux version of scratch-link.
From my perspective:
In the near future, we (Raspberry Pi foundation) will need to make some decisions about how to make a future Scratch 3 Raspberry Pi extensions "talk" to the hardware and the presence (or not) of a linux version of scratch-link is a factor.
Current thinking (no more than that, subject to change, etc) is that comms would be via TCP to the pigpiod daemon running on the Pi.
Are there any plans for a scratch-link version for linux? Is it a consideration?
The text was updated successfully, but these errors were encountered: