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

Unified Diff: samples/raspberry_pi/basic/door-bell.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 | « samples/raspberry_pi/basic/buzzer.dart ('k') | samples/raspberry_pi/basic/knight-rider.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/raspberry_pi/basic/door-bell.dart
diff --git a/samples/raspberry_pi/basic/door-bell.dart b/samples/raspberry_pi/basic/door-bell.dart
index 39c959ff2c10f46c7caca39a77bfbdf48e0c49e8..ad43655a1a9186dc941e98f1386eda6a7e5ea1da 100644
--- a/samples/raspberry_pi/basic/door-bell.dart
+++ b/samples/raspberry_pi/basic/door-bell.dart
@@ -8,6 +8,7 @@
// https://storage.googleapis.com/fletch-archive/images/buzzer-schematic.png
import 'package:gpio/gpio.dart';
+import 'package:raspberry_pi/raspberry_pi.dart';
import 'package:os/os.dart';
main() {
@@ -15,12 +16,13 @@ main() {
const int button = 16;
const int speaker = 21;
- // Initialize GPIO and speaker pin.
- SysfsGPIO gpio = new SysfsGPIO();
+ // Initialize Raspberry Pi and configure the pins.
+ RaspberryPi pi = new RaspberryPi();
+ SysfsGPIO gpio = pi.sysfsGPIO;
+
+ // Initialize pins.
gpio.exportPin(speaker);
gpio.setMode(speaker, Mode.output);
-
- // Initialize button pin. Enable a button down trigger.
gpio.exportPin(button);
gpio.setMode(button, Mode.input);
gpio.setTrigger(button, Trigger.both);
« no previous file with comments | « samples/raspberry_pi/basic/buzzer.dart ('k') | samples/raspberry_pi/basic/knight-rider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698