Discuss Scratch

itchy20
Scratcher
100+ posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

@Metrology
The online version should support the HTTP protocol, but you would need to load an existing project that already contains the extension blocks, since the online version does not have a menu choice to just load the block files. If you look in the ScratchFiles/ScratchProjects folder under s2a_fm, there are “base” projects in the various supported languages. These projects contain the s2a_fm blocks and when you File/Upload from your computer in Scratch, you will have a project with a blank program, but all of the extension blocks available. For English, you can select s2a_fm_base.sb2

The Scratch team has asked that projects that use HTTP extensions not be shared. So if I my understanding is correct, you can save an HTTP extension project, but just keep it private.

I have not used the javascript extension mechanism, so I cannot advise you there. Your best bet might be to leave a question at LLK on github.
Animepony1
New Scratcher
2 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

Metre Hahe Jak La Ça ^Haya Kak Hajeiei Doctor Who Ter Kake Frozen && Kya 785 Sesehty Kale R Scracth.
SCRAXE
New Scratcher
72 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

Metrology1234 wrote:

Hi
I am still having trouble with the offline version does your comment mean that the online version supports HTTP as well as java script.
How do I load the javascript examples http://llk.github.io/scratch-extensions/? I have hosted one of the examples on google drive and tried to load it into the online version but it does nothing. No error message to tell be the problem. Any advice?

The javascript does work (in online version only). Try this one out, its one that I modified for the picoboard and works ok - use this as the extension path
http://tinyurl.com/nrxf9k4
However if you have any typo or incorrect grammar (e.g. missing comma) in the javascript it will instantly stop working, silently not doing anything at all (no warning or error msg)

Http does work in online version, as long as you open/modify a sb2 file that was originally created in the offline version. There is no menu to activate http method directly in the online version. You can't use javascript in the offline version.
.
Metrology1234
New Scratcher
7 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

Thanks for your help and patience everyone.
For the online version .
I have got my program sending the cross policy domain file and it accepts command blocks and responds ok. The trouble is I don't get any poll requests from scratch. Is there something I am missing.

SCRAXE
New Scratcher
72 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

That'll be because /poll is for http only.

For javascript the function in the block definition is directly called whenever Scratch needs that value, so for instance in the picoboard example the slider reporter is defined as:

            ['r', 'slider',		'getSlider'],

Scratch will then directly call ‘getSlider’ whenever it needs to update the slider value.

So you need a matching function such as

    ext.getSlider = function()  { 
return 25;
};

that gives you the value to be used.
Metrology1234
New Scratcher
7 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

SCRAXE wrote:

That'll be because /poll is for http only.

For javascript the function in the block definition is directly called whenever Scratch needs that value, so for instance in the picoboard example the slider reporter is defined as:

            ['r', 'slider',		'getSlider'],

Scratch will then directly call ‘getSlider’ whenever it needs to update the slider value.

So you need a matching function such as

    ext.getSlider = function()  { 
return 25;
};

that gives you the value to be used.
For this test I am trying to use HTTP with the online version as itchy20 suggested earlier.
Trelawny
Scratcher
5 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

Hello

I am getting this error message when sending FirmataPlus or FirmataPlusLBT to the Arduino “total_ports was not declared in this scope”

Please help!
Trelawny
Scratcher
5 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

Panic over - I'd installed it in the wrong place.
braniti
New Scratcher
2 posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

Dear Alan , thank you for you great work … my 10 year old kids managed to run basics using your s2a_FM on their ubuntu … one big question : How can we modify existing game they made , in plain Scratch 2.o offline without this extension , so that new Blocks within your extension can be used ? It seems you have to start from zero using new blocks and build game( that is not an option cause their game costs a lot of work) … any advice ? Or is it possible to copy/paste code between Scratch files? thanx
itchy20
Scratcher
100+ posts

Just released s2a_fm - a hardware extension for Arduino/Scratch Integration

@braniti

If I understand your question correctly, you have an existing Scratch project and you wish to add s2a_fm blocks to that project.

If that is what you are trying to do, here is how you can do it:

1. Load your existing project into Scratch.
2. Press and hold the Shift key while clicking on the File menu item in Scratch. You should see a new choice at the bottom of the list that says, “Import experimental HTTP extension”. Select that choice.
3. In the folder where you have the s2a_fm files, there should be a folder called ScratchFiles/Extension Descriptors. Find the file that matches your language and click OK in file dialog box.

This should load the s2a_fm blocks (just go to More Blocks to make sure they are there). If you then save your project (I would use Save As with a new name, in case anything goes wrong), you should be able to load the project and it should now contain the s2a_fm blocks.

Please let me know if that works for you or if I totally misunderstood your question.

Powered by DjangoBB