| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c8da6ff commit b5c213f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,20 +1,20 @@ | |||
| 1 | 1 | import processing.io.*; | |
| 2 | 2 | color bgcolor = 0; | |
| 3 | 3 | ||
| 4 | - // RPI.PIN3 refers to the physical pin 3 on the Raspberry Pi's | ||
| 5 | - // pin header, which is located on the third row, next to a | ||
| 6 | - // Ground pin | ||
| 4 | + // RPI.PIN7 refers to the physical pin 7 on the Raspberry Pi's | ||
| 5 | + // pin header, which is located on the fourth row, above one of | ||
| 6 | + // the Ground pins | ||
| 7 | 7 | ||
| 8 | 8 | void setup() { | |
| 9 | - GPIO.pinMode(RPI.PIN3, GPIO.INPUT); | ||
| 10 | - GPIO.attachInterrupt(RPI.PIN3, this, "pinEvent", GPIO.RISING); | ||
| 9 | + GPIO.pinMode(RPI.PIN7, GPIO.INPUT); | ||
| 10 | + GPIO.attachInterrupt(RPI.PIN7, this, "pinEvent", GPIO.RISING); | ||
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | 13 | void draw() { | |
| 14 | 14 | background(bgcolor); | |
| 15 | 15 | } | |
| 16 | 16 | ||
| 17 | - // this function will be called whenever pin 3 is brought from LOW to HIGH | ||
| 17 | + // this function will be called whenever pin 7 is brought from LOW to HIGH | ||
| 18 | 18 | void pinEvent(int pin) { | |
| 19 | 19 | println("Received interrupt"); | |
| 20 | 20 | if (bgcolor == 0) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,18 +1,18 @@ | |||
| 1 | 1 | import processing.io.*; | |
| 2 | 2 | ||
| 3 | - // RPI.PIN3 refers to the physical pin 3 on the Raspberry Pi's | ||
| 4 | - // pin header, which is located on the second row, next to the | ||
| 5 | - // 5v power pin | ||
| 3 | + // RPI.PIN7 refers to the physical pin 7 on the Raspberry Pi's | ||
| 4 | + // pin header, which is located on the fourth row, above one of | ||
| 5 | + // the Ground pins | ||
| 6 | 6 | ||
| 7 | 7 | void setup() { | |
| 8 | - GPIO.pinMode(RPI.PIN3, GPIO.INPUT); | ||
| 8 | + GPIO.pinMode(RPI.PIN7, GPIO.INPUT); | ||
| 9 | 9 | // this is equivalent to addressing the pin with its GPIO number: | |
| 10 | - // GPIO.pinMode(2, GPIO.INPUT); | ||
| 10 | + // GPIO.pinMode(4, GPIO.INPUT); | ||
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | 13 | void draw() { | |
| 14 | 14 | // sense the input pin | |
| 15 | - if (GPIO.digitalRead(RPI.PIN3) == GPIO.HIGH) { | ||
| 15 | + if (GPIO.digitalRead(RPI.PIN7) == GPIO.HIGH) { | ||
| 16 | 16 | fill(255); | |
| 17 | 17 | } else { | |
| 18 | 18 | fill(204); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,25 +1,25 @@ | |||
| 1 | 1 | import processing.io.*; | |
| 2 | 2 | boolean ledOn = false; | |
| 3 | 3 | ||
| 4 | - // RPI.PIN5 refers to the physical pin 5 on the Raspberry Pi's | ||
| 5 | - // pin header, which is located on the third row, next to a | ||
| 6 | - // Ground pin | ||
| 4 | + // RPI.PIN7 refers to the physical pin 7 on the Raspberry Pi's | ||
| 5 | + // pin header, which is located on the fourth row, above one of | ||
| 6 | + // the Ground pins | ||
| 7 | 7 | ||
| 8 | 8 | void setup() { | |
| 9 | - GPIO.pinMode(RPI.PIN5, GPIO.OUTPUT); | ||
| 9 | + GPIO.pinMode(RPI.PIN7, GPIO.OUTPUT); | ||
| 10 | 10 | // this is equivalent to addressing the pin with its GPIO number: | |
| 11 | - // GPIO.pinMode(3, GPIO.OUTPUT); | ||
| 11 | + // GPIO.pinMode(4, GPIO.OUTPUT); | ||
| 12 | 12 | frameRate(0.5); | |
| 13 | 13 | } | |
| 14 | 14 | ||
| 15 | 15 | void draw() { | |
| 16 | 16 | // make the LED blink | |
| 17 | 17 | ledOn = !ledOn; | |
| 18 | 18 | if (ledOn) { | |
| 19 | - GPIO.digitalWrite(RPI.PIN5, GPIO.LOW); | ||
| 19 | + GPIO.digitalWrite(RPI.PIN7, GPIO.LOW); | ||
| 20 | 20 | fill(204); | |
| 21 | 21 | } else { | |
| 22 | - GPIO.digitalWrite(RPI.PIN5, GPIO.HIGH); | ||
| 22 | + GPIO.digitalWrite(RPI.PIN7, GPIO.HIGH); | ||
| 23 | 23 | fill(255); | |
| 24 | 24 | } | |
| 25 | 25 | stroke(255); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments