Experience with block languges?

Hello.

I am trying to see if anyone has had any luck with Photons and snap4arduino, s4a.cat, or some other block-based language.

Thanks,

Michael

I can’t say that I have, but then I would say if you are using a block language you are not programming.

Have looked into Node Red though? It lets you link IOT services and things together in a block like way.

Thanks for your reply, nrobinson2000. I looked at Node-RED a bit, but the groups I’m trying to introduce programming to (middle to high school students) are more likely to have seen Scratch and (possibly) Snap!, and if they work with Arduino, I figure they might work with Photon as well – I plan to try tomorrow.

I’m not sure if I buy your argument that visual programming isn’t programming – it is different, and (possibly) more cumbersome than writing code, but a) it is instructing the computer to do something, b) it does involve all the standard structures and concepts you’ll see in a text-based programming language (variables, loops, decision structures, first class lists, first class functions, objects, abstraction). If you’ve got some time, take a look at Snap! in particular, and how it’s used at Berkeley, I think you’ll be pleasantly surprised.

2 Likes

I was only joking. :wink: I started my programming journey with Scratch when I was eleven and I had a lot of fun with it until I outgrew it.

Just to follow up, I’ve played around with Snap4Arduino, using Firmata for Spark – it’s available in the libraries, StandardFirmata.ino – and I can now control my Photon through that (hurray!).

However, Snap4Arduino only has blocks for the basics (setting pins, and getting analog and digital readings from them).

SA5Firmata_2, which works with Snap! and Arduino, comes with additional Arduino-specific Snap! blocks, but not all of the ones that would be suitable for Particle (e.g., ones to publish/subscribe), and it doesn’t seem to work with the Photon.

Does anyone with a better idea of what Firmata is doing (and that’s probably everyone reading this) have an idea how I add additional blocks to Snap4Arduino to provide addess to more Particle functionality? Is this even possible?

Thanks for any insights …

1 Like

I’m fairly certain that those block based languages control the device in real time like Tinker over serial.

I agree with @nrobinson2000. Firmata is designed to be remotely controlled, providing an API to the controlling device. Without the controlling device, Firmata does nothing.

1 Like

OK, so I’m begining to get a glimmer of how this is workng … Snap4Arduino is sending byte streams to StandardFirmata, which is running on my Photon. But it’s still basically a Photon, correct, in communication with the Particle Cloud?

The reason I ask is because, in StandardFirmata.ino’s setup(), I’ve defined Particle.variable(“pinChosen”,pinChosen);, yet both Particle-Dev and the web console deny all knowledge of such a variable (indeed any Particle variables).

Related to this, is it possible to debug an .ino file in Firmata? I don’t see any debugging tools, and I think my serial port is being used by Fermata, so I can’t even see if the new command I’ve created, as per these instructions here, is being invoked.

1 Like

Try placing those at the top of the setup() function, that might make a difference if they weren’t there already.

1 Like