Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE.md file. | |
| 4 | |
| 5 import "dart:dartino"; | |
| 6 import "dart:async"; | |
| 7 import "package:lk/leds.dart"; | |
| 8 | |
| 9 int count = 0; | |
|
ricow1
2016/02/09 09:06:08
remove unused variable
herhut
2016/02/09 10:10:15
Thanks!
| |
| 10 | |
| 11 makeCallback(LED) { | |
| 12 bool value = false; | |
| 13 return (Timer timer) { | |
| 14 LED.setState(value); | |
| 15 value = ! value; | |
| 16 }; | |
| 17 } | |
| 18 | |
| 19 void main() { | |
| 20 // Reset all LEDs for good measure. | |
| 21 LED0.setState(false); | |
| 22 LED1.setState(false); | |
| 23 LED2.setState(false); | |
| 24 LED3.setState(false); | |
| 25 | |
| 26 // Add some blinking action. | |
| 27 new Timer.periodic(const Duration(milliseconds: 50), makeCallback(LED0)); | |
|
Søren Gjesse
2016/02/09 09:16:01
If you add toggle to LED (and make state both a ge
herhut
2016/02/09 10:10:15
Done.
| |
| 28 new Timer.periodic(const Duration(milliseconds: 100), makeCallback(LED1)); | |
| 29 new Timer.periodic(const Duration(milliseconds: 75), makeCallback(LED2)); | |
| 30 new Timer.periodic(const Duration(milliseconds: 333), makeCallback(LED3)); | |
| 31 } | |
|
lukechurch
2016/02/09 09:20:01
Consider adding an explanatory comment as to why t
herhut
2016/02/09 10:10:15
Done.
| |
| OLD | NEW |