Chromium Code Reviews| Index: samples/raspberry_pi/basic/blinky.dart |
| diff --git a/samples/raspberry_pi/basic/blinky.dart b/samples/raspberry_pi/basic/blinky.dart |
| index fb688a95ab4861678a74e67f9a633e8a7af27d36..2a012021f88396f20fe5173b370a816a682af137 100644 |
| --- a/samples/raspberry_pi/basic/blinky.dart |
| +++ b/samples/raspberry_pi/basic/blinky.dart |
| @@ -6,21 +6,23 @@ |
| // Raspberry Pi 2 activity LED. |
| import 'package:gpio/gpio.dart'; |
| +import 'package:raspberry_pi/raspberry_pi.dart'; |
| import 'package:os/os.dart'; |
| main() { |
| // Constant for the Raspberry Pi 2 onboard green LED. |
| const int led = 47; |
|
mit
2015/10/05 07:26:13
Should remove this constant
Søren Gjesse
2015/10/05 07:43:39
Done.
|
| - // Initialize gpio and configure the pin. |
| - PiMemoryMappedGPIO gpio = new PiMemoryMappedGPIO(); |
| - gpio.setMode(led, Mode.output); |
| + // Initialize Raspberry Pi and configure the activity LED to be GPIO |
| + // controlled. |
| + RaspberryPi pi = new RaspberryPi(); |
| + pi.leds.activityLED.setMode(OnboardLEDMode.gpio); |
| // Turn LED on and off in a continuous loop. |
| while (true) { |
| - gpio.setPin(led, true); |
| + pi.leds.activityLED.on(); |
| sleep(500); |
| - gpio.setPin(led, false); |
| + pi.leds.activityLED.off(); |
| sleep(500); |
| } |
| } |