Guide to mbed Compiler on tablet device

The Compiler IDE already makes it easy to log in from any PC and carry on where you left off and we've pushed that portability one step further by adding touch support for tablet devices.

They are often considered consumer devices, but the mbed Compiler utilizes the touch control to deliver state-of-the-art editing, along with intuitive workspace management. The following guide explains the basics, the limitations and the workarounds to enable efficient workflow.

Note that, in the moment of writing, this guide is applicable to Android and iOS enabled tablet devices. We will update it once we add support for tablets based on other platforms (Surface, ChromeOS).

Browser of choice and limitations

This is the first and most important choice as it defines how the compiled program binaries are handled, how fast the mbed Compiler IDE performs and how it utilizes the screen space.

Android is liberal towards changing the default browser and open access to the file system. The default Android browser will not let you save the compiled binary files if you intend to connect the mbed board to the tablet. We recommend the Chrome and Dolphin browsers over the default one as both of them handle the download of binary files gracefully and additionally Dolphin can enable full screen of the mbed Compiler which will increase the usable screen space. The downloaded programs can then be moved to the mbed flash drive using a file manager, such as Astro or EStrong File Manager from the Google Play store.

iOS on other hand is very strict towards security and changing the default browser might not be the better choice as the default (Safari) browser receive JavaScript Nitro acceleration through the OS. In terms of usability, the Safari browser also allows adding the mbed Compiler as native home screen application (see the images below), which is not only handy shortcut, but also enables full screen mode.

/media/uploads/screamer/add_to_homescreen_1.png /media/uploads/screamer/add_to_homescreen_2.png

Note that due to iOS restrictions, the filesystem on the mbed board cannot be directly accessed (given that it's connected via iPad/iPhone USB adapter), which also means that one cannot save the compiled binary files to an mbed board.

Given that you picked the browser that suits your taste let's jump on the next topic...

Touch control method

The mbed Compiler touch support consists of two very different control methods depending on functionality - editing and workspace management.

Editor

  • Single Tap - Moves the cursor to the tapped position.
  • Double Tap - Text selection on the tapped word and opens context menu.
  • Triple Tap - Text selection on the tapped row and opens context menu.
  • Tap-Hold - Opens the context menu.
  • Tap-Drag - Text selection mode until the touch is released (and opens context menu).

Compiler IDE

  • Single Tap - Equivalent to single mouse click.
  • Double Tap - Equivalent to double mouse click.
  • Tap-Hold - Equivalent to right click (context menu).
  • Tap-Drag - Equivalent to mouse dragging.

Even though different, one will find them intuitive for the type of task they are designed for.

Editing input methods

While using touch control method feels comfortable and intuitive, many developers (including myself) don't find the virtual keyboard capable of long development cycles, mainly due to the lack of physical separation between the keyboard buttons and the lack of key click feedback, both leading to numerous typing errors. Also two fingers shortcuts (if they are present - not on iOS) could be tricky and problematic, not to mention the lack of tab key and copy/paste shortcuts - all of which greatly reduce the editing capabilities.

We've found several options - some of them valuable, others just a proof of concept.

Virtual Keyboard

The Android platform offers virtual keyboard skinning, keyboard gesturing and other input methods as part of the platform design. Each hardware vendor extends the Android default virtual keyboard with their own implementation(s), and if that's not enough, the Google Play store offers even more virtual keyboard solutions. While not perfect for the reasons listed above, there are various development-friendly layouts that will make the development easier and more enjoyable.

The iOS platform doesn't allow customized keyboard layouts, and just to make it worse, the most common special characters, such as tab, [](){}<>:;, and numbers are two or three taps away on the default keyboard layout or nowhere to be found.
A visual workaround for the iOS 5+ virtual keyboard is to split it using two fingers split gesture (see the image below).

/media/uploads/screamer/split_keyboard.png

It will only reduce the size the of keyboard and make it semi-transparent, but won't extend the set of keys. The virtual keyboard can also be repositioned by dragging the right side of very bottom-right button (the horizontal stripes).

Cover/built-in keyboard

Some tablets, like the Asus Transformer are bundled with a nicely-designed, state-of-the-art, space-saving, tablet-protecting keyboard cover, which literally turns the tablet into very thin, lightweight, 10" laptop-alike device.
Others, like the iPad, could use hard covers like the Logitech Keyboard Case for an extra cost, which will enable the complete set of keys, including the all time favorite - tab and copy/paste.

Mini Bluetooth keyboard

There are various mini bluetooth keyboards, varying from very cheap to quite expensive ones, and while not popular for a daily use, they certainly feel like learning to type on a feature phone - once you get used to it you can type really fast.

Wired keyboard

Both Android and iOS based tablets support USB attached keyboard, given that the tablet is equipped with a normal USB port, either natively or through an adapter.
It makes little sense to use a wired keyboard though, as if one is carrying a wired keyboard, then why not use a laptop instead?!

Now that we tackled the control methods, let's jump on the next topic...

Workflow

Instead of writing pages and pages of text about the touch control features, we have prepared a walk-through video (best preview in full screen, 1080p).

Note that the actual performance is much better than shown in the video. The screen recording in 2048x1536 resolution took a large chunk of the tablet CPU performance!

Conclusion

It's no wonder why tablets have a market on their own - they are powerful lightweight portable devices, with intuitive and relatively accurate pointing precision, capable of delivering both platform-based and web-based applications - the key ingredient for the mbed Compiler to exist on a tablet ecosystem.

By nature they are consumer oriented devices, hence the lack of physical keyboard, which is not a blocker if you're planning to manage your workspace, publish, import and make minor source code modifications. If you're willing to fully unleash the development on a tablet though, then get a keyboard extension/bundle and save yourself the frustration from the virtual keyboard.

If you are planning to connect an mbed board then keep mind that the iOS platform is very restrictive towards file access, and even if you're able to download and save the program binary, it won't let you save it directly on the mbed board. This is somewhat unfortunate because in our experience the iOS based tablets are good fit for the task - the (retina) screen is in comfortable 4:3 format and the platform manages to deliver sleek performance with no slowdown or hitches - it simply works.

On the performance side, Android isn't too far behind iOS, especially after the Android 4.0.4 update, and most importantly it doesn't have the restrictions listed above, thus Android is the first platform fully capable of rapid prototyping - create in the mbed Compiler, experiment on an mbed board, share on the mbed website with the mbed community!.

And last but not least ...

Compatibility list

This isn't a compatibility list for the mbed Compiler, but for the mbed microcontrollers. Different mbed boards have different power consumption rating, as also different tablets can deliver different power to USB port. This compatibility list is for when an mbed board is powered by the tablet USB port only and there are no other consumers/devices attached to the mbed board itself.

Note that all mbed boards are designed to run on backup battery power with minimal USB power drain, thus making it possible to use the mbed board on a tablet that has limited USB power.

Legend:

  • /media/uploads/screamer/check_ok.png - the board is powered and accessible
  • /media/uploads/screamer/check_not.png - the board isn't powered or hardware limitation occurs
  • o - the filesystem is restricted by the platform
  • w - the filesystem cannot be accessed due to insufficient power
  • p - the filesystem can be accessed but errors may occur due to power fluctuations
  • * - there is an issue or regression - see the comments below
  • ? - untested
Tabletmbed NXP LPC11U24mbed NXP LPC1768mbed NXP LPC2368
Apple iPad 1/media/uploads/screamer/check_ok.pngo?/media/uploads/screamer/check_not.pngwo/media/uploads/screamer/check_not.pngwo
Apple iPad 2/3/media/uploads/screamer/check_ok.pngo/media/uploads/screamer/check_not.pngwo/media/uploads/screamer/check_not.pngwo
Asus EEE Transformer TF101/media/uploads/screamer/check_ok.png/media/uploads/screamer/check_ok.png*?
Motorola Xoom/media/uploads/screamer/check_ok.png??

Do you have a tablet not listed above? Do you want to contribute to the list? Drop us a note with details corresponding to the compatibility list and we will add it. Thanks in advance!





15 comments:

23 Oct 2012

Are you planning to release a USB serial driver for Android so that printf/scanf I/O is possible as well as developing and dowloading code.

24 Oct 2012

Hi, just gave my ipad2 with a Bluetooth keyboard a go. Everything works as decribed, except the cursor keys. These do work in this very window and other editable text field, but not in the compiler window.... Any clues?

Regards, Willem

24 Oct 2012

copied from a G+ post I made: https://plus.google.com/u/0/102274619900215106301/posts/cf8M45Ts8Zr

+mbed I tested this on my ASUS Transformer Prime: - TF201 with keyboard dock - official ASUS Android Jelly Bean. - mbed with LPC1768 processor - Chrome browser

result of the tests:

1. mbed module connects fine to USB port of keyboard dock: powers up instantly

2. mbed mounted automatically as USB MSC (USBdisk1) on the tablet, browsins, reading and writing of files OK

3. online IDE work fine in Chrome. One thing seems counter-intuitive: sliding in the editing window selects a bunch of text, while any other app I use on the tablet uses this gesture to scroll through the text. Even if I know it by now, I still do it because that's the way I am used to work on my tablet. All other features are fine and editing and writing code works just great.

4. compiler works fine, and downloads binary in the /sdcard/download directory, as expected (I noticed that the stock Android browser doesn't download the file)

5. file copy and past onto mbed module = OK

6. BUT: when rebooting the mbed module (using either the button or just coldbooting by removing the cradle and plugging it back in) doesn't let the LPC1768 load the newly compiled code. While this still works with files downloaded on the PC, it doesn't work on the tablet.

If you would need me to perform extra tests, please just ask!

24 Oct 2012

Hi Christopher,

Can you please send me 3 7z/zip archives of the compiled program that you downloaded on:

  • your desktop
  • your tablet
  • your mbed board (the one you downloaded on the tablet and then copied on the board)

I'm going to compare the three of them and the difference (if any) will tell me about the source of the problem. It's also possible that the Android tablet somehow corrupts the copied data on the mbed board... may be?

Thanks in advance.

Mihail

24 Oct 2012

Hi Willem,

Thanks for the bug report.

I managed to reproduce the arrow keys regression and now it's fixed against the current private beta. If you are interested to try it, then drop me a message and I'll send you the details.

Mihail

25 Oct 2012

Mihail, I would not mind giving it a try!

Regards, Willem

26 Oct 2012

This is great!!! I have been waiting for this for a while. When you say "the filesystem is restricted by the platform", does it mean it can't be accessed because there is no way to see the file system? How about with a jailbroken iPad? Will it show the mounted folder? I wish I could try this but I recently upgraded my iPad to iOS6.

03 Nov 2012

Hi guys,

I'm going to give this a go....

A Couple of things to report...

The Screen size is not optimised for iPad with Retina display... And there's still a large border around the IDE, as if it's imitating being inside a window.

I had one question - what about the ipad camera connection kit? I know back in the day the USB component of that was accessible to all sorts of different peripherals. Would it not be possible for you to - perhaps - build a native app skeleton that has a web widget (for viewing the IDE), alongside some gubbins for using the USB part of the camera connection kit natively via iOS?

It would be the thinnest veneer on top of the IDE, but the only thing is that this would go completely against the grain of being we-centric in your delivery of the GUI/IDE etc.

05 Nov 2012

Hi Alex, everyone,

The screen size is optimized for landscape mode of all iPad models, including the iPad retina display on which in fact it was developed.
Even though the retina display is 2048x1536, the browser always reports 1024x768 as native resolution, making it possible for all pre-iPad 3 websites to look exactly the same on all iPad models.
The blue border is kind of a trademark of the mbed Compiler, wearing the blue color of the mbed logo, etc, and I personally do not find the 4 blue pixels on each side irritating in any way.

There are various restrictions that the iOS applies to attached memory devices:

  • the memory card must be FAT16/FAT32 formatted
  • it must contain a DCIM folder in the card root
  • the DCIM folder must contain at least one valid vendor subfolder - e.g. 100CANON, 100DICAM, etc
  • all non-vendor subfolders are ignored - e.g. OLD, MINE, WHATEVER
  • the valid subfolder should contain file names that are matching the vendor naming convention - IMG_nnnn.JPG, DSC_nnnn.JPG, MVI_nnnn.MOV
  • files that are identified as non-images, non-videos are completely ignored
  • one can only import valid files from the memory card but not save or export to it

I'm uncertain whether the capabilities to operate with attached memory device are only given to Apple signed apps, such as Photos/iPhoto, though if true, any native app won't be allowed to access an external media (unverified).

As for the jailbroken iPad - many web resources claim that it's possible to access attached memory device via /var/mnt/mount1 mount point using iFile, yet even if I had vast experience with jailbreaking I won't give advices to jailbreak your iPad simply because this is not how it's intended to be used and if you don't know what you're doing you may (and if not careful most probably WILL) brick your iOS device.
With that said if one is proficient in jailbreaking and are willing to share their experience with mbed board attached to an iPad, then I'm kindly asking them to share in a safe manner while keeping in mind that not everyone are used to the process and that it may pose harm to their device.

Thanks in advance.

Mihail

12 Nov 2012

Hi,

I'm trying to use galaxy note 10.1 (N8010) but I can't type anything in the code, I can edit it, delete characters, move the cursor etc. but I can't type new code. Maybe I'm doing something wrong. Please help!

P.S. I'm using Chrome on Android 4.0.4

21 Nov 2012

Just tried with a Nexus 7 and a LPC1768. Seems to work fine - but the device has to be rooted to allow access to the mbed via an USB-OTG-cable...

29 Nov 2012

To add to the post of Christopher Peirs I just tried to download a file from an asus transformer 700 to my (brand new) mbed and I found how to get the software to load correctly. (with firmware 21164)

To get step 6 working you need to unmount the mbed drive and press the reset button.

11 Jan 2013

I have tried unmounting the mbed from my Asus transformer 700 and it still does not load the bin file upon reboot. Has anyone figured out why yet?

22 Jan 2013

user Charles Wilt wrote:

I have tried unmounting the mbed from my Asus transformer 700 and it still does not load the bin file upon reboot. Has anyone figured out why yet?

Same problem on an Asus Transformer TF300. If I then plug the mbed into my desktop and copy and paste the same bin file it will load. Have you tried using a file manager besides the Asus one?

23 Jan 2013

I have tried several different ones. I think the problem is that android creates a directory named "lost.dir". Otherwise the the bin file is identical between PC download and asus download.

The odd thing is that I can delete the lost.dir, reset, and it still does not load the .bin file.

I would love to see this work.

user Michael Mogenson wrote:

user Charles Wilt wrote:

I have tried unmounting the mbed from my Asus transformer 700 and it still does not load the bin file upon reboot. Has anyone figured out why yet?

Same problem on an Asus Transformer TF300. If I then plug the mbed into my desktop and copy and paste the same bin file it will load. Have you tried using a file manager besides the Asus one?

Posting new comments for this page has been disabled