bromagosa / Snap4Arduino

Binding Snap! and Arduino together
http://snap4arduino.rocks
GNU Affero General Public License v3.0
133 stars 85 forks source link

Send Sysex message from arduino to snap4arduino #288

Closed deno750 closed 2 years ago

deno750 commented 5 years ago

Hello, I'm trying to figure out how to receive data from arduino throgh sysex. On my firmata code I did this:

Firmata.write(START_SYSEX); Firmata.write(STRING_DATA); Firmata.write(2); Firmata.write(END_SYSEX);

And on the block definition I did that:

this.arduino.board.once('string', function (data) { ready.add(data); }); this.arduino.board.sp.write(new Buffer([0XF0, 0x0D, 0xF7]));

Here there's the entire block definition. image

When I try to run the block, I don't receive any value from arduino.

I'm using snap4arduino through ecraft2learn. The chromium/chrome plugin is intsalled correctly and the arduino connects successfully.

jguille2 commented 5 years ago

Hi Denis (@deno750)!

Excuse our delay, but holidays... :(

I have to test this to be sure, but some comments to start...

I need more info. I guess you have defined a new SYSEX command, haven't you? Because your "firmata code" must be into a case 0x0D: section (you use this '0x0D' to run the command from the block).

I you have already done this, test tho change "this.arduino.sp.write" to "this.arduino.transport.write".

Test this, and we continuous....

Joan

lhong01 commented 2 years ago

Hello @deno750 sorry to bother you. I'am a newbie with s4a and wanted to ask you where i can find information in order to program my own s4a blocks with javascript

I googled a lot about this.arduino.board function but i'am not finding anything...and a little about sysex codes...

This just helped me a little bit https://blog.s4a.cat/2015/03/13/Extending-Firmata-for-Snap4Arduino.html

jguille2 commented 2 years ago

Hello @lhong01

That doc (from Citilab) is fine.

If you want to see more examples, maybe it is interesting for you SA5Firmata

Tell me if you need something more...

Joan