SPIN In Blockly?
![Jwolf](https://forums.parallax.com/uploads/userpics/097/nCUBU4JFYX9BM.jpg)
I have many completed projects in SPIN and often clip pieces of code for use in new projects... this saves a tremendous amount of time.
I would like to be able to do this with Blockly. Is there a way to insert spin code as a new block/function?
A great example is custom display routines for a WS2812 LED strip. I've created 80 amazing displays for led strips in SPIN, these display routines do not interact directly with the LED's, rather they create variables for position and color, which would take forever to recreate in blockly... Ideally I would like to define a new block which I could simply paste the spin code into.
I would like to be able to do this with Blockly. Is there a way to insert spin code as a new block/function?
A great example is custom display routines for a WS2812 LED strip. I've created 80 amazing displays for led strips in SPIN, these display routines do not interact directly with the LED's, rather they create variables for position and color, which would take forever to recreate in blockly... Ideally I would like to define a new block which I could simply paste the spin code into.
Comments
-Phil
I realize many users here would like Spin support in BlocklyProp. You'll need to give us a pardon on the request. We can't do everything, all the time. Consider that adding Spin support is a 4,000 hour request by the time we've got it fully documented, working, and supported in tutorials.
Ken Gracey
I was expecting more... much more
Yes. There are two ways to go about doing this, I suppose.
One way is to insert the converted spin2cpp code in a user-defined block in BlocklyProp, which allows you to put C code directly into your program.
The more official route, which is better for long-term, is to make a GitHub request with your converted C code and ask us to create a block for it. Then, we'll integrate it with our library distribution, create a reference guide for using the blocks, and make it a permanent part of BlocklyProp. Only a few people have gone this route- likely because it's a fair amount of work to go from tire-kicking to driving the car.
Ken Gracey
for example, the MEMSIC 2125... I'd like to use variable assignments which retrieve XY Accel & XY Tilt, in SPIN loops.
Such as this bit of code (obviously pin assignments will be completed later)
http://blockly.parallax.com/blockly/projectlink?id=63808&key=bdfc2970-3743-443a-862b-88fea61ce700
That being said, the BlocklyProp project itself is open source, so you can dive and and see how the blocks generate C code...it's not actually that complicated. You *could* create SPIN generators for each of the existing blocks if you wanted, and build a custom version of the offline app...
Look for the offline app elsewhere here in the forums for all the code and a few instructions to get you going.
Similar to how OBJ is used... I would like to create a program in blockly for the LSM9 IMU sensor, then load that into a new cog within a spin program so that I can constantly poll readings.