jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.5k stars 744 forks source link

Lego wedo #1137

Closed jcaldw737 closed 5 years ago

jcaldw737 commented 8 years ago

Does anyone have an interface between snap and Lego wedo blocks?

cycomachead commented 8 years ago

These ones? https://education.lego.com/en-gb/lesi/elementary/wedo-2

Unfortunately, as I was told by a sales rep a couple months ago that WeDo has no publicly available API. :frowning:

Perhaps there may be a way to reverse-engineer their API (I believe it's just bluetooth?) or that I could have been told something wrong, but at the moment I think you're out of luck. I'd love to be proven wrong though!

brianharvey commented 8 years ago

You can program it in Scratch, so it's doable. I suggest you just send one to Connor. He's our robot guy.

jcaldw737 commented 8 years ago

Thanks to you and Michael Ball for getting back so quickly. I will take your suggestion.

cycomachead commented 8 years ago

I think the one on the Scratch Wiki might be a different version (1.0 or something) since the parts look different from the ones I've played with.

If you can get a scratch version to work, @bromagosa Is also working on a Scratch Extension loader for Snap!. I'm not sure how far along it is right now, but that could be an option to look at.

bromagosa commented 8 years ago

Hi there!

I got quite far, I can already load extensions. We're talking hardware though, and hardware needs a serial port to talk to...

jcaldw737 commented 8 years ago

That is great news! About the serial port. As you know doubt know there is one because I have plugged in the Lego Wedo and controlled it with SCRATCH. So what do we need to make it work with SNAP! - pass a port number or ?

bromagosa commented 8 years ago

That's right, we could theoretically just reuse their browser plugin and extension... I'll give that a shot! :)

The only issue being I don't have a Wedo, so you'll have to be my guinea pig.

bromagosa commented 8 years ago

It loaded out of the box:

gas

I had to dig quite a bit to find the extension file, because it's embedded in the Scratch UI and I'm actually not sure it's meant to be public... does anyone know more about this?

The notice in the file doesn't say anything about license or copyright, which usually means it's copyrighted material:

// wedoExtension.js
// Shane M. Clements, January 2014
// LEGO WEDO Scratch Extension
//
// This is an extension for development and testing of the Scratch Javascript Extension API.
jcaldw737 commented 8 years ago

WOW! Thank you so very, very much!

It is so exciting to see Lego blocks with SNAP! at the top of the screen. Of course, I'll be the guinea pig!!! My Lego stuff is at my office, and I have already set an alarm to remind me to get them tomorrow (Thursday) morning. What's the url to use to reach your wonderful new blocks for testing?

Thank you again! Your combination of perseverance and excellence is most impressive!

brianharvey commented 8 years ago

Shane is shanemc@mit.edu You could ask about whether we're allowed to use it.

On 2/17/16 4:06 AM, Bernat Romagosa wrote:

It loaded out of the box:

gas

I had to dig quite a bit to find the extension file, because it's embedded in the Scratch UI and I'm actually not sure it's meant to be public... does anyone know more about this?

The notice in the file doesn't say anything about license or copyright, which usually means it's copyrighted material:

// wedoExtension.js
// Shane M. Clements, January 2014
// LEGO WEDO Scratch Extension
//
// This is an extension for development and testing of the Scratch Javascript Extension API.

Reply to this email directly or view it on GitHub: https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/issues/1137#issuecomment-185173047

jcaldw737 commented 8 years ago

Ok, I got my Lego Wedo Stuff and it works on my laptop with Scratch. Is the next step for me to try it with SNAP! I am guessing I need a URL different from standard SNAP!

bromagosa commented 8 years ago

Shane hasn't answered yet, but since his code is somewhat publicly findable and we're just using it, not modifying or redistributing it or anything of the sort, I guess there is no problem...

This is a temporary url: http://vps34736.ovh.net:8080/snap.html

Note that the extension mechanism is a work in progress. I have only tested reporters and commands, but hat blocks may very well not work.

That said, to try the Lego WeDo extension, you need to click on the file menu, select "Import extension..." and paste the extension url: https://cdn.scratch.mit.edu/scratchr2/static/js/scratch_extensions/wedoExtension.js

jmoenig commented 8 years ago

Shane has left LLK and is now working at Google. Not sure whether he checks his MediaLab email account at all.

https://www.linkedin.com/in/shanemclements

bromagosa commented 8 years ago

I see, I'll contact him over LinkedIn. Thanks, Jens!

jcaldw737 commented 8 years ago

Progress! I was able to get to the special version of SNAP! and I was able to import the extension and get to the tab LEGO WeDo. But when I clicked on various blocks, the motor did not come on. Without changing anything on the Lego end, I went to the SCRATCH site and was able to turn the motor on.

bromagosa commented 8 years ago

Yep, as I said, this is all very experimental, sorry... I'm not sure what other things need to be done in order to get the extension to work... I'll see if I can get my hands on one of these and check it out myself.

jcaldw737 commented 8 years ago

I am not one bit sorry, I am thrilled - and very, very appreciative! It has been a long time since I set up Lego with Scratch, but I remember there was something I had to do. So I tried to use Lego with Scratch on a different computer and got the screen whose capture is attached. It is possible that the installation process I did needs to be redone with SNAP as the "target" rather than "SCRATCH? legoscratch

jcaldw737 commented 8 years ago

I didn't add the following on my previous comment, and it may be obvious, but just in case ...

I got to the SCRATCH screen about extensions by clicking:

More Blocks Add an Extension LEGO WeDO

jcaldw737 commented 8 years ago

It seems like we (ok, really you) were so close to getting SNAP to work with LEGO WeDO. Is there any chance to get it done before the start of next semester? If it would help, I could send one of our LEGO WeDO sets out to you.

Thanks in advance for whatever can be done! :)

bromagosa commented 8 years ago

Let me rope @jguille2 into this (currently on holiday so he may take a while to reply), because if I recall he already managed to hook WeDo to Snap! :)

jcaldw737 commented 8 years ago

THANKS for the fast response! Sounds exciting that someone may have done this already. We have plenty of time now.

Thanks again.

jguille2 commented 8 years ago

Hi! Still on holidays... but I've just made this project and a first docs to show a quick solution.

Some words to explain our work...

jcaldw737 commented 8 years ago

It worked! It worked!! It worked!!!

THANK YOU VERY MUCH!!! AND THANK YOU EVEN MORE FOR TAKING TIME FROM YOUR HOLIDAY TO MAKE THE PROJECT AND NOTES.

jguille2 commented 8 years ago

Ok!

I'm working with Arduino. Then, any feedback or problems (with wedo or other hardware) will be apreciated.

to be continued...

Joan

jcaldw737 commented 6 years ago

Now I am trying again after a long time and I may have forgotten something.

When I test using S2Bot(Win) - Scratch to Bot(17301) I can turn my motor1 on and off

But when I load the project snapBlocks_WeDo and click the block turn motorA on , nothing happens

HELP!

jcaldw737 commented 6 years ago

I have tried this on both Chrome and FireFox using Windows 10.

jguille2 commented 6 years ago

Hi @jcaldw737,

I think the problem is into the http/https protocol: Snap online is now forced to https, but S2Bot needs http.

So you have to run Snap! over http. A quick solution is to use Snap4Arduino online (still over http).

Joan

cycomachead commented 6 years ago

I will have a solution to the https issue later today. :)

http://extensions.snap.berkeley.edu will be a home for an http-only version of Snap!

-- Michael Ball From my iPhone michaelball.co

On Sep 16, 2018, at 3:41 AM, Joan Guillén i Pelegay notifications@github.com wrote:

Hi @jcaldw737,

I think the problem is into the http/https protocol: Snap online is now forced to https, but S2Bot needs http.

So you have to run Snap! over http. A quick solution is to use Snap4Arduino online (still over http).

Joan

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

jcaldw737 commented 5 years ago

This is issue is closed as a result of the help I received in issue #2363