| OLD | NEW |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 // | 4 // |
| 5 // The 'hello world' of embedded: Blinking an LED. Uses the on-board | 5 // The 'hello world' of embedded: Blinking an LED. Uses the on-board |
| 6 // Raspberry Pi 2 activity LED. | 6 // Raspberry Pi 2 activity LED. |
| 7 | 7 |
| 8 import 'package:gpio/gpio.dart'; | 8 import 'package:gpio/gpio.dart'; |
| 9 import 'package:raspberry_pi/raspberry_pi.dart'; | 9 import 'package:raspberry_pi/raspberry_pi.dart'; |
| 10 import 'package:os/os.dart'; | 10 import 'package:os/os.dart'; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 // Initialize Raspberry Pi and configure the activity LED to be GPIO | 13 // Initialize Raspberry Pi and configure the activity LED to be GPIO |
| 14 // controlled. | 14 // controlled. |
| 15 RaspberryPi pi = new RaspberryPi(); | 15 RaspberryPi pi = new RaspberryPi(); |
| 16 pi.leds.activityLED.setMode(OnboardLEDMode.gpio); | 16 pi.leds.activityLED.setMode(OnboardLEDMode.gpio); |
| 17 | 17 |
| 18 // Turn LED on and off in a continuous loop. | 18 // Turn LED on and off in a continuous loop. |
| 19 while (true) { | 19 while (true) { |
| 20 pi.leds.activityLED.on(); | 20 pi.leds.activityLED.on(); |
| 21 sleep(500); | 21 sleep(500); |
| 22 pi.leds.activityLED.off(); | 22 pi.leds.activityLED.off(); |
| 23 sleep(500); | 23 sleep(500); |
| 24 } | 24 } |
| 25 } | 25 } |
| OLD | NEW |