<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
this sounds as thou it has legs, very much along the ideas of the lego programming language which was visual blocks ( as it's lego what other concept would they use!)<div>if you need some help with the node.js stuff gimme a shout, as it's my app server for my FT work</div><div>Regards Pete<br><br><div><div id="SkyDrivePlaceholder"></div>> From: developers-request@concurrency.cc<br>> Subject: developers Digest, Vol 26, Issue 3<br>> To: developers@concurrency.cc<br>> Date: Wed, 4 Jul 2012 12:00:02 +0100<br>> <br>> Send developers mailing list submissions to<br>>         developers@concurrency.cc<br>> <br>> To subscribe or unsubscribe via the World Wide Web, visit<br>>         http://lists.concurrency.cc/mailman/listinfo/developers<br>> or, via email, send a message with subject or body 'help' to<br>>         developers-request@concurrency.cc<br>> <br>> You can reach the person managing the list at<br>>         developers-owner@concurrency.cc<br>> <br>> When replying, please edit your Subject line so it is more specific<br>> than "Re: Contents of developers digest..."<br>> <br>> <br>> Today's Topics:<br>> <br>> 1. Prototype drag-and-drop (Matt Jadud)<br>> <br>> <br>> ----------------------------------------------------------------------<br>> <br>> Message: 1<br>> Date: Tue, 3 Jul 2012 10:53:18 -0400<br>> From: Matt Jadud <matt@jadud.com><br>> Subject: [CCC DEV] Prototype drag-and-drop<br>> To: developers@concurrency.cc<br>> Message-ID:<br>>         <CAAGM454YB1iQkgEgykGyZsmqe9QigRDrN3ZEWHq5TzuiZHjv0Q@mail.gmail.com><br>> Content-Type: text/plain; charset=ISO-8859-1<br>> <br>> Hi all,<br>> <br>> [ TL;DR: It's a prototype visual environment. I have no idea if I've<br>> just reinvented something we already had around. Is it worth pursuing<br>> further, and who is interested? ]<br>> <br>> I have a prototype drag-and-drop environment for the Arduino.<br>> <br>> http://www.youtube.com/watch?v=ejzbrOroHTw<br>> <br>> The source (*cough*) is in Github:<br>> <br>> https://github.com/craftofelectronics/ardu-see<br>> <br>> To save you digging through a pile:<br>> <br>> 1. The web interface is thrown together with WireIt, which is built on<br>> the YUI library from Yahoo. Yahoo Pipes is built using this library.<br>> <br>> 2. The blocks in the interface are specified in JSON. For example, the<br>> "Read Sensor" block specification looks like this:<br>> <br>> {<br>> "name": "Read Sensor",<br>> "container": {<br>> "xtype": "WireIt.FormContainer",<br>> "title": "read_sensor",<br>> "icon": "res/icons/application_edit.png",<br>> "collapsible": true,<br>> "fields": [<br>> {"type": "select", "inputParams": {"label": "Pin", "name":<br>> "1int", "selectValues": ["A0", "A1", "A2", "A3", "A4", "A5"] } },<br>> ],<br>> "terminals": [<br>> {"name": "0out", "direction": [0,1], "offsetPosition":<br>> {"left": 100, "bottom": -15}}<br>> ],<br>> "legend": "Read my sensor and output its value."<br>>                  }<br>>          }<br>> <br>> There are some fragile things in here. For example, the names are<br>> "0out" and "1int", which are how I'm encoding parameter order and<br>> type. (But, the prototype is assuming that everything is an INT,<br>> because it is 1) invisible to the user and 2) allows for a great deal<br>> of flexibility.)<br>> <br>> 3. When you hit Load or Save, it pushes your data to http://parse.com/.<br>> <br>> 4. When you hit Run, it pushes a JSON representation of the graph to a<br>> Node.JS server. (Why? Because it was the easiest thing I could find<br>> that would serve both static content and an RPC call.)<br>> <br>> 5. The JSON server runs a small Scheme utility to 1) parse the JSON<br>> and 2) spit out a piece of occam-pi. Given a JSON structure like this:<br>> <br>> {"name":"","project":"","working":{"modules":[{"name":"Read<br>> Sensor","value":{"1int":"A0"},"config":{"position":["18","24"]}},{"name":"Turn<br>> On In Range","value":{"1int":"2","2int":"0","3int":"100"},"config":{"position":["104","223"]}}],"wires":[{"src":{"moduleId":"0","terminal":"0out"},"tgt":{"moduleId":"1","terminal":"0in"}}],"properties":{"name":"","project":"","description":""}}}<br>> <br>> it outputs<br>> <br>> <br>> #INCLUDE "ardu-see-ardu-do.module"<br>> PROC main1341326514 ()<br>> CHAN INT wire01:<br>> PAR<br>> ReadSensor(A0, wire01!)<br>> TurnOnInRange(2, 0, 100, wire01?)<br>> :<br>> <br>> 6. For this to work, we have to implement each block in occam-pi.<br>> That's not hard.<br>> <br>> #INCLUDE "plumbing.module"<br>> <br>> VAL INT READ.DELAY IS 500:<br>> <br>> PROC ReadSensor (VAL INT pin, CHAN INT out!)<br>> INITIAL INT avr.pin IS board.analog.to.chip(pin):<br>> WHILE TRUE<br>> INT reading:<br>> SEQ<br>> delay(READ.DELAY)<br>> adc.base(avr.pin, VCC, reading)<br>> out ! (reading / 11)<br>> :<br>> <br>> PROC TurnOnInRange (VAL INT pin, min, max, CHAN INT in?)<br>> WHILE TRUE<br>> INT value:<br>> SEQ<br>> in ? value<br>> IF<br>> (value >= min) AND (value <= max)<br>> digital.write(pin, HIGH)<br>> TRUE<br>> digital.write(pin, LOW)<br>> :<br>> <br>> 7. The Node.JS server then invokes the toolchain and uploads things.<br>> (My Mac environment for command-line building is poor, so really, I<br>> should just be able to call "occbuild" and be done. But, that's not<br>> how this script works at the moment.)<br>> <br>> 8. Upload is handled by avrdude. My Arduino is hardcoded in.<br>> <br>> That's about it, really. It's a prototype. I put it together because<br>> I'd like to teach an intro electronics course that has digital<br>> electronics, but I'd rather not have to teach programming (per se).<br>> Going to tools like Ardublocks or Modkit means a sequential world, and<br>> students still have to wrestle through lots of details that are, quite<br>> simply, unpleasant. (Or, if you prefer: if the course was primarily<br>> and only about digital electronics and an introduction to programming,<br>> I could probably fit a bit more programming instruction in... but, at<br>> the moment, I suspect not.)<br>> <br>> My question is: can we bring this around before September-ish? Specifically:<br>> <br>> 1. Can we put together something that runs on Mac and Windows?<br>> (Ideally, all three.)<br>> 2. The JavaScript side is, for all intents and purposes, "done." That<br>> is, adding new blocks is easy. Writing a bit of occam to represent the<br>> block is likewise easy.<br>> 3. We can write the server in anything we like: a stand-alone Python<br>> server that gets the job done works for me. I may explore whether it<br>> is possible to easily get a (compiled) stand-alone server to run in<br>> Scheme. If so, that would solve cross-platform packaging.<br>> 4. The user needs to find/specify the Arduino... somehow. I have some ideas.<br>> 5. Some error checking, somewhere, might be a good idea.<br>> <br>> It would be nice to have something that leveraged our tools that<br>> anyone could use to quickly explore the Arduino. The environment is<br>> highly constrained, and allows me (as an educator) to limit what<br>> students are able to do in sensible ways. Or, if you prefer, the<br>> environment lets students focus on the circuit and the problem they're<br>> trying to solve, and not get lost in details of the programming...<br>> while allowing them to easily prototype systems with multiple sensors,<br>> on multiple inputs, with multiple outputs.<br>> <br>> That's enough writing. I'll probably put a blog post up on<br>> http://craftofelectronics.org/ about this, which might be less<br>> verbose, more conceptual, and clearer.<br>> <br>> Many thanks,<br>> Matt<br>> <br>> <br>> <br>> ------------------------------<br>> <br>> _______________________________________________<br>> developers mailing list<br>> developers@concurrency.cc<br>> http://lists.concurrency.cc/mailman/listinfo/developers<br>> <br>> <br>> End of developers Digest, Vol 26, Issue 3<br>> *****************************************<br></div></div>                                            </div></body>
</html>