Design a Block Language for Arduino

February 7th, 2011 § 1 comment § permalink

I have been playing around with OpenBlocks. It’s a very flexible environment to create a new block language. When it comes to design one for Arduino, I found myself wondering between two different styles of design.

Design I

The first design is of course to follow the Arduino Language Reference closely. However, the resulting block language seems to be a bit too “verbose?” Or should I say “busy” since it’s really a graphical representation of the textual program. Here is a sample of what it looks like for the equivalence of codes here.

void setup() {
  pinMode(1, INPUT);
  pinMode(2, OUTPUT);
}
void loop() {
  if (digitalRead(1) == HIGH) {
    digitalWrite(2, LOW);
  }
}

Vpl 1

Design II

Since the block language is targeted at the beginner of Arduino and programming, most of time, we talk about “When the button on pin 1 is pushed, I want the LED on pin 2 to light up.” There is a much natural way to map this statement into an intuitive block language by building the blocks around the pin. Here is how it may look like:

Vpl 2

This language is more concise and easier to understand. The language itself should provide enough meta info to infer the setup codes. However, in order to do this, the language may need a little runtime (OS?) to be compiled along with the Sketch but it seems to be worth the effort.

The OpenBlocks codes I am playing around with the idea is available at my ‘ant’ branch openblocks on github. Appreciate any feedback on this.

]]>

Visual Programming Language for Arduino (1)

February 5th, 2011 § 0 comments § permalink

To make Arduino easier for non-programmers, I decided to start a visual programming environment similar to Scratch for Arduino.

Similar Projects around the Web

Modkit is a similar project but at the time I wanted to start the project, it was in a closed alpha. Also, it seems that modkit is going to be proprietary and I want an open source VPL for Arduino. By the way, Modkit CrimpCards is an awesome idea and design.

S4A (Scratch for Arduino) is another interesting project but it’s for using Scratch with Arduino instead of programming for Arduino.

David Mellis over at MIT Media Lab also has a project called “Scratch for Arduino” but no detail yet. David is also one of the creator of Arduino platform.

Arduino IDE and OpenBlocks

Fork the source of Arduino IDE hosted on github to host my version here. Next stop is to find a library for the visual programming. I found a project called OpenBlocks developed as part of the MIT StarLogo NG. Open Blocks is also used in Google’s Android development tool App Inventor.

Both Arduino IDE and Open Blocks are written in Java so the integration should be smooth. Since I have done by share of Java, I decided to also use this opportunities to look into a few alternative languages running on JVM to implement this. Since I have done mostly Ruby for the past few years, JRuby looks pretty good. The language I really want to use is Clojure but it seems it’s a bit tricky to use it embedded in a Java app. Will give both a try and see how it goes.

Let the hacking beging!

Hopefully, we will have a running version in the next few weeks. ]]>

Where Am I?

You are currently browsing entries tagged with ide at 新车间 [XinCheJian].