Events

System resources and time define events. All events can be handled using the every keyword.

every accelerometer.any_motion { }
every 60 seconds { }

Time comes in different resolutions:

  • milliseconds
  • seconds
  • minutes
  • hours

Most platforms can only define a limited amount of timers. Therefore the number of time event handlers is limited by that amount. Furthermore, since time is a limited resource, especially on embedded devices, events can be handled multiple times. Event handlers will be executed in the order they appear in the source code.

var foo = 0;
every accelerometer.any_motion { 
    foo = 1; 
}
every accelerometer.any_motion { 
    foo = 2; 
}