Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Unified Diff: samples/raspberry_pi/basic/blinky.dart

Issue 1389573002: Refactor Raspberry Pi GPIO and add GPIO mock (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Remove unused constant Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/raspberry_pi/lib/raspberry_pi.dart ('k') | samples/raspberry_pi/basic/buzzer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..df112a6a3274e223b68ef1c4721e98eedf86310b 100644
--- a/samples/raspberry_pi/basic/blinky.dart
+++ b/samples/raspberry_pi/basic/blinky.dart
@@ -6,21 +6,20 @@
// 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;
-
- // 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);
}
}
« no previous file with comments | « pkg/raspberry_pi/lib/raspberry_pi.dart ('k') | samples/raspberry_pi/basic/buzzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698