Site update 1.2 part 1: Notebooks
Some of you may have noticed that a site update was pushed out to the mbed servers last night, which we're calling mbed 1.2.
Over the next couple of blog posts, I'm going to take a closer look at some the new features and perhaps some of our ideas for the future.
In this post, I'll tell you a bit about notebooks.
Notebooks
We've given you all a notebook. A notebook is simply a place to make notes. Each page of notes can be anything from a quick reminder of a pinout to a detailed how-to on a subject complete with illustrations.
Why notebooks?
We created notebooks to allow mbed developers to share information. You can search inside other people's notebooks and link to notebooks. You can tag and describe your notebook pages to aid in searching.
How do I use my notebook?
A Notebook is made up of pages. Adding a notebook page is easy.

Go to your new My Home (more on that later) and then the Notebook. Clicking Add new notebook page will open a pane where you can make a start on your page.
How do I tell people about my notebook pages?
We have added a couple of new buttons to the standard editor window used in posts. On the far right hand side of the editor toolbar, you'll see buttons for inserting a link to your Published Programs and Notebook Pages. I'll explain some suggested work-flows for making the most of these buttons in a later post.

Can I get feedback on notebook pages?
Each notebook page has space for comments and discussion below it. If someone leaves a comment on one of your pages, you'll get an email letting you know.
Can notebook pages be private?
All notebook pages are public. However, you do have the option of setting a notebook page to be Unlisted. Unlisted pages don't show up in your user activity feed (more on that later!) and don't show up in search results. They also won't appear in the list of your notebook pages when someone visits your Home area.
Please note that even if your page is marked as unlisted, anyone can still view it if they know the URL.
What about the cookbook?
What about the cookbook, you may ask. The cookbook has served us well up till now, but a single "flat" wiki would become increasingly difficult to manage as our small mbed community grew. Plus, there are technical issues involved which make the cookbook non-optimal.
The cookbook isn't going away just yet! Notebooks are missing a key feature - that being the ability to create group pages to allow collaboration on building an information reference.
So, use notebooks if you can, and we'll be working on ways to integrate more of the cookbook features. When the cookbook replacement is ready, cookbook pages will be copied into any new group documentation feature. So you can continue using the Cookbook with confidence, and we'll be engaging the mbed community in designing the eventual replacement.
That's it for this quick introduction to Notebooks.
As ever, the Notebooks feature will evolve and improve over time in response to user feedback. We already have some early feedback which may be the subject of a small further update to come soon.
My next blog post will talk about User Activity and your Home area.
Dan
Chris is on TV!
If anyone was watching sky channel 880 last night at around 10.15, you'd have seen Chris in his garage with a big wooden box and an mbed.
But why? Well, a team from "Teachers TV" asked to come to film him doing some of his activities as a "STEM Ambassador"; someone who goes out and helps with Science, Technology, Engineering, Maths in schools. The result is a 15 min video which shows some experiments going on during a visit to a local school.
It should be no surprise that it was based around using mbed, but it was a great reminder of what triggered mbed in the first place. It was many moons ago that we were trying to do the same thing in the schools with "traditional" kit, and getting very frustrated (as were the kids); it got in the way of their ideas. It was the classic scratch your own itch scenario, with us thinking "it could be so much better!".
Interestingly, the best decision I think we ever made in tackling this problem was not to go and build something specifically for taught education. We decided to try and make something that solved the problems we were seeing, but where it was a generic problem that was applicable to anyone trying to prototype something. The position we took was particularly inspired by the books "Deschooling Society" (Ivan Illich, 1971) which was a great reminder that people should always be learning (i.e. not just in taught environments), and "The Paradox of Choice" (Barry Schwartz, 2004), explaining how a lot of complexity can be attributed to choice paralysis/overload. My own interpretation of this is that it is common to pass on decisions to users in the form of "options", where infact you are actually passing on complexity and hard decisions. Finally, we wanted to ensure we could make it commercially viable so it could support continuous investment in itself.
As and example of how these school visits impacted our thinking, I can remember one day going in to a school and seeing their electronics lesson (I wish I had a photo!); they were soldering leaded components to copper tape stuck on to cardboard. I couldn't even do that; you need three hands! Worse still, as you apply the heat, the glue on the copper tape melts and peels of the card! I'm sure there were good reasons, but at some level you have to ask yourself why industry doesn't do it like that?!
It was things like this that focused us on wanting to make industry-style tools more accessible; using C/C++ rather than dreaming up some graphical flowchart programming to "make it easy", or using 0.1" pitch rather than a simple (but ultimately restrictive) "modular system".
The great thing about this video was it reminded us we'd been able to come full circle, and apply mbed back to what originally inspired us. What started as a little skunk-works project is now a real product, and we're hoping to continually improve on it to help more people experiment with microcontrollers. Whilst taught education is certainly not our primary focus, we hope mbed will find a home with some people who want to apply it to let students explore these sorts of things.
And don't worry if you missed it! It is now published on Teachers TV, so go check it out! You even get to see the mbed HQ white board in the background at one point :)
Tutorial: Getting mbed in and out of breadboard!
Someone recently commented that once an mbed was in breadboard, it was a little tricky to get out. I've also seen a few cases in workshops where examples wern't working for people, and it was simply due to the mbed not being pushed in to the breadboard properly (usually because it is stiff, and the user didn't want to damage anything - better to be careful!).
So here are a couple of videos with some simple recommendations. Firstly, getting your mbed in to the breadboard:
Secondly, getting it back out:
For removal, the emphasis is on working it out slowly with light pressure to avoid bending pins, and ensuring you only press the shaft of the screwdriver against the edge of the mbed and the tip against the breadboard by pulling up. If you push down, you'll scrape the underside of the mbed with the screwdriver tip which will not be good news!
So use these simple approaches, take your time, and treat the hardware with care, and you'll be fine!
Library Update: Real-Time Clock
We thought it was about time to get time() working...
The mbed Microcontroller has a Real-Time Clock (RTC) on it, which is a built in hardware clock that can keep track of the time and date. We've now done the plumbing to make use of it sane, and you can now just use standard C functions to read, set and format the time. Ideal for data logging and other time related functions!
The basic function to read the time is named time(). This returns the time in seconds since January 1st 1970, often known as the UNIX timestamp. This is a fairly universal way to define time, and can be transformed in to other string forms using C functions. The function time() actually takes a pointer as an argument, but in most case you'll just want to pass NULL. Here is a most basic example to get the current time:
#include "mbed.h"
int main() {
while(1) {
time_t seconds = time(NULL);
printf("Seconds since January 1, 1970: %d\n", seconds);
wait(1);
}
}
Of course, that isn't much use until the time has been set somehow, as the RTC won't have been setup. Here is the minimal way to set the time, in this case providing the UNIX timestamp:
#include "mbed.h"
int main() {
set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
}
A natural thing to want to do is display the time and/or date in a human readable way, either on a screen, in a file, or over a terminal. For that, C provides a number of functions to help do this. This example shows these functions in use:
#include "mbed.h"
int main() {
while(1) {
time_t seconds = time(NULL);
printf("Time as seconds since January 1, 1970 = %d\n", seconds);
printf("Time as a basic string = %s", ctime(&seconds));
char buffer[32];
strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
printf("Time as a custom formatted string = %s", buffer);
wait(1);
}
}
The results of this are shown below:

For all the string formatting options, see the list of format specifiers in the strftime function api documentation.
While we were testing, Rolf said he thought it'd be nice to be able to set the time from the terminal, so here is the final example for this post that does just that:
// Example to setup the Real-Time Clock from a terminal, sford
#include "mbed.h"
int main() {
// get the current time from the terminal
struct tm t;
printf("Enter current date and time:\n");
printf("YYYY MM DD HH MM SS[enter]\n");
scanf("%d %d %d %d %d %d", &t.tm_year, &t.tm_mon, &t.tm_mday
, &t.tm_hour, &t.tm_min, &t.tm_sec);
// adjust for tm structure required values
t.tm_year = t.tm_year - 1900;
t.tm_mon = t.tm_mon - 1;
// set the time
set_time(mktime(&t));
// display the time
while(1) {
time_t seconds = time(NULL);
printf("Time as a basic string = %s", ctime(&seconds));
wait(1);
}
}
Hopefully this gives you a good insight in to how to use the RTC from software, but of course one of the nice features of the RTC is that it is designed to support a battery backup. This means just like your PC or various equipment around the house, the mbed can keep time even when the power is disconnected.
It obviously needs some source of power to keep the clock running, but it is very tiny and this is where the VB pin comes in. By connecting a 3V battery to this pin, the clock can be kept running for a long time with only a single coin cell (watch battery). Wire a 3v coin cell battery between VB and GND, and when you disconnect the main power (e.g. USB cable) the clock will continue to run:

For full details of the time related functions, see the time API page:
To update to this new library version, as ever just start a new project or select the existing mbed library in an existing one and hit "Update". Please feedback any problems/questions to the forum.
Have Fun!
mbed @ ARM Techcon
Just to let you know, we'll be at ARM Techcon in Santa Clara this week:
If you are in the area, please come along and find us if you get the chance; it'd be great to chat, especially if you already got hold of an mbed or know what your plans are when yours comes through!
NXP should be doing a demo session on Thursday too (~1pm), so if mbed is new to you it may be a great way of getting an intro.
See you there,
Simon






