Version 2.2. introduces support for its second language, motlle. Motlle has C-like syntax, but a few semantic differences (e.g., it is dynamically typed, has an 'any' type). This is a sample snippet of motlle code, for trivial count to leds functionality:
any counter = 0; // Declare counter with type any
settimer0(10); // Start timer 0
any timer0() { // Timer handler: increment counter, set the LEDs
led(++counter & 7);
}As with TinyScript, these programs are compiled with a very small number of bytes and can be dynamically installed on a network, for application-level sensor network programming without touching nesC.
motlle has several nice language features. For example, functions are first class variables:
any average_sensor(sense) {
any real_sense() {
return (sense() + sense()) / 2;
}
return real_sense;
}This allows you to, for example, create an averaging light sensor:
any avg_light = average_sensor(light);
and call it like any other function
any reading = avg_light();
The basic types know to motlle are integers, floats, lists, vectors, and strings. However, RAM constraints on the Telos rev A (and our lack of rev Bs at this time) cause motlle to be supported on the TOSSIM, mica2, and mica2dot platforms.
Phil
-------
"We shall not cease from exploration And the end of all our exploring Will be to arrive where we started And know the place for the first time."
- T. S. Eliot, 'Little Gidding' _______________________________________________ Tinyos-users mailing list [EMAIL PROTECTED] http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users
