FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing/java/libraries/io/examples/Interrupt/Interrupt.pde at master · allenk/processing · GitHub
allenk
processing
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
processing
/
java
/
libraries
/
io
/
examples
/
Interrupt
/
Interrupt.pde
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (21 loc) · 601 Bytes
Breadcrumbs
processing
/
java
/
libraries
/
io
/
examples
/
Interrupt
/
Interrupt.pde
Copy path
File metadata and controls
25 lines (21 loc) · 601 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
processing.io.*
;
color
bgcolor
=
0
;
//
GPIO numbers refer to different phyiscal pins on various boards
//
On the Raspberry Pi GPIO 4 is physical pin 7 on the header
//
see setup.png in the sketch folder for wiring details
void
setup
() {
GPIO
.
pinMode(
4
,
GPIO
.
INPUT
);
GPIO
.
attachInterrupt(
4
,
this
,
"
pinEvent
"
,
GPIO
.
RISING
);
}
void
draw
() {
background
(bgcolor);
}
//
this function will be called whenever GPIO 4 is brought from LOW to HIGH
void
pinEvent
(
int
pin
) {
println
(
"
Received interrupt
"
);
if
(bgcolor
==
0
) {
bgcolor
=
color
(
255
);
}
else
{
bgcolor
=
color
(
0
);
}
}
Back
|
FazBrowse Home
|
New Git URL