Processing, 類GPIO
中的digitalRead()
用法介紹。
用法
.digitalRead(pin)
參數
pin
(int)
通用輸入輸出引腳
返回
int
說明
例子
import processing.io.*;
// On the Raspberry Pi GPIO 4 is physical pin 7 on the header
void setup() {
// INPUT_PULLUP enables the built-in pull-up resistor for this pin
// left alone, the pin will read as HIGH
// connected to ground (via e.g. a button or switch) it will read LOW
GPIO.pinMode(4, GPIO.INPUT_PULLUP);
}
void draw() {
if (GPIO.digitalRead(4) == GPIO.LOW) {
// button is pressed
fill(255);
} else {
// button is not pressed
fill(204);
}
stroke(255);
ellipse(width/2, height/2, width*0.75, height*0.75);
}
相關用法
- Processing GPIO.digitalWrite()用法及代碼示例
- Processing GPIO.pinMode()用法及代碼示例
- Processing GPIO.releasePin()用法及代碼示例
- Processing GPIO.releaseInterrupt()用法及代碼示例
- Processing GPIO.waitFor()用法及代碼示例
- Processing GPIO.attachInterrupt()用法及代碼示例
- Processing GPIO.interrupts()用法及代碼示例
- Processing GPIO.noInterrupts()用法及代碼示例
- Processing GPIO用法及代碼示例
- Processing FFT用法及代碼示例
- Processing SawOsc.pan()用法及代碼示例
- Processing FloatDict用法及代碼示例
- Processing FFT.stop()用法及代碼示例
- Processing join()用法及代碼示例
- Processing () (parentheses)用法及代碼示例
- Processing Pulse用法及代碼示例
- Processing PShader用法及代碼示例
- Processing PVector.set()用法及代碼示例
- Processing FloatDict.sortKeysReverse()用法及代碼示例
- Processing texture()用法及代碼示例
- Processing IntDict.add()用法及代碼示例
- Processing PShape.enableStyle()用法及代碼示例
- Processing FloatDict.sub()用法及代碼示例
- Processing String用法及代碼示例
- Processing PImage.pixels[]用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 GPIO.digitalRead()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。