12:37下午 ~ 2 Comments

Pin Blocks Design

Finally got a few hours to test out a few Pin block design ideas for the ArduBlock. The goal of the design is to enable users to naturally express their intention into the blocks. Most of the Arduino programs are reactive to the INPUT value on the pin and this naturally leads to an event driven design on the PIN block.

Handling Digital Input and Output

The block below basically represent the “Hello World” of Arduino Programming mapping to the code fragments


  if (digitalRead(1) == HIGH) {
    digitalWrite(2, HIGH);
  }

Untitled

Multiple events on the same pin should be support by defining multiple events on the same pin. It seems that a good visual grouping of the same pin would be a good thing and improve readability of the program.

Untitled

The OpenBlocks come with a pretty cool annotation system to add comments to block. This could be leveraged to enhance the readability of the program.

Untitled

Handling Analog Input and Output

The analog I/O handling should work the same way as the digital one.

Untitled

Doing conditional statements with Pin. The Pin 3 is identified with color in the ‘if’ statement. Maybe a label on it will work better.

Untitled

Functional Programming or Object Oriented?

Since Clojure is used as programming language to drive the ArduBlock, it seems that it pushes my design of the block language to have more functional programming favor. It may be a good thing to make program more straight forward to understand and to program. But really need to guard against the tunnel vision.

Rule Engine?

Since I am using a rule engine in a project right now, I may also be influenced by that. I see all these blocks laying out conditions to trigger actions. It may be worth a while to see if a small Reta Algorithm can be easily implemented in Arduino to handle the rules layout by the blocks. This seems to be a nature way to design a run time for this language.