Since Blockly was announced, one thing I wanted to do was to compare it for writing a more complex program using C and SampleIDE. I decided to rewrite my C program for controlling the ActivityBot using a SIRC TV remote and whiskers for reacting to obstacles.
My SimpelIDE C program is here: forums.parallax.com/discussion/comment/1399840/#Comment_1399840
There were a few changes between the 2 versions, some due to some Prop C features not being included in Blockly and some to change the Bot user interface.
Blockly doesn’t have Switch/case (requiring a long sequence of “else-if”s), and it doesn’t have the Propeller.h features including “waitpne” that I use as part of the whisker detection function.
The change I made was to eliminate using the TV remotes volume +/- for changing the Bot’s speed, instead just using the numeric keypad. (the 2 key for increasing speed, 8 for decreasing).
All the changes were easy to make and the program was quickly developed using my procedure notes for the program that I had written when originally writing the C program (with new changes for the different remote commands for speed change.)
The Blockly code is shown in the attachments. Main() and the whisker detection function in “blockly-abot-tv-main-whisker.pdf” and the function to calculate the adbot drive_speed values in 2 files “blocky-abot-tv-calcmove2a.pdf” and “blocky-abot-tv-calcmove2b.pdf”.
The Blockly project itself is located at: http://blockly.parallax.com/blockly/editor/blocklyc.jsp?project=3931
You do have to login.
Having the Blockly editor/compiler on line was nice since I could access it from any of my computers.
Building the large Blockly program took some effort managing all the blocks. Because of the large number of similar blocks that I used, I had a lot of duplicated blocks and groups of blocks scattered over the worksheet, which required some care to make sure that I deleted all the unused ones.
Since the calcmove function was so long, and one of the conditional blocks in “whisker” was so wide, it took some effort to position the different sections so they didn’t interfere with each other.
The only problem I had was in figuring out how to use the “if-do” block to add “else-if”. The interactive “help” did say that the else or else-if conditionals can be added, but it took some searching in the “community” projects to find one that showed how to do it. A sentence should be added to the reference for if-do that explains that the else-if is added to the if-do image in the small box that opens when clicking on the “gear”.
Another issue is printing the blocks in a large program. Downloading the blocks file results in an SVG file. The file opens in a web browser, but doesn’t fully print out, which is why it took 2 files to hold the calcmove function listing.
I’m not sure if Blockly is intended for making large programs, but it does work.