-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.d
More file actions
43 lines (35 loc) · 689 Bytes
/
app.d
File metadata and controls
43 lines (35 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import rpisysfsgpio;
import std.stdio;
import core.thread;
void main()
{
// Sample LED blinking.
RpiSysFsGpio gpio = new RpiSysFsGpio();
int pin = 7, i;
if (!gpio.isExported(pin)) {
gpio.exportPin(pin);
}
writeln("Blinking...");
gpio.direction(
pin,
gpio.IN
);
for (i = 0; i < 10; i++) {
gpio.write(
pin,
gpio.HIGH
);
Thread.sleep(dur!("seconds")(1));
gpio.write(
pin,
gpio.LOW
);
Thread.sleep(dur!("seconds")(1));
}
writeln("Done.");
gpio.write(
pin,
gpio.LOW
);
gpio.unexportPin(pin);
}