Index: dart/examples/led/led.dart |
diff --git a/dart/examples/led/led.dart b/dart/examples/led/led.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c122e676da5d3840920fe1cac49fc940783fe3ba |
--- /dev/null |
+++ b/dart/examples/led/led.dart |
@@ -0,0 +1,16 @@ |
+// Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE.md file. |
+ |
+import "dart:dartino"; |
+import "dart:async"; |
+import "package:lk/leds.dart"; |
+ |
+void main() { |
+ // Start up some timers. Note that timers in dartino are based on fibers, |
+ // so even though the main fiber ends, the timers will keep running. |
+ new Timer.periodic(const Duration(milliseconds: 50), (_) => LED0.toggle()); |
+ new Timer.periodic(const Duration(milliseconds: 100), (_) => LED1.toggle()); |
+ new Timer.periodic(const Duration(milliseconds: 75), (_) => LED2.toggle()); |
+ new Timer.periodic(const Duration(milliseconds: 333), (_) => LED3.toggle()); |
+} |