查看DigitalRead()的源代碼
←
DigitalRead()
跳轉(zhuǎn)至:
導(dǎo)航
、
搜索
因為以下原因,你沒有權(quán)限編輯本頁:
您剛才請求的操作只有這個用戶組中的用戶才能使用:
用戶
您可以查看并復(fù)制此頁面的源代碼:
<pre style="color:blue"> int digitalRead (uint8_t pin) </pre> 讀數(shù)字引腳<br> 讀數(shù)字引腳, 返回引腳的高低電平. 在讀引腳之前, 需要將引腳設(shè)置為INPUT模式.<br> 參數(shù):<br> *pin 引腳編號 返回:<br> HIGH或LOW <pre style="color:green"> int ledPin = 13; // LED connected to digital pin 13 int inPin = 7; // pushbutton connected to digital pin 7 int val = 0; // variable to store the read value void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output pinMode(inPin, INPUT); // sets the digital pin 7 as input } void loop() { val = digitalRead(inPin); // read the input pin digitalWrite(ledPin, val); // sets the LED to the button's value } </pre> 注解:<br> 如果引腳沒有鏈接到任何地方, 那么將隨機返回 HIGH 或 LOW.
返回
DigitalRead()
。
來自“
http://lifestyle201.com/wiki/index.php/DigitalRead()
”
導(dǎo)航菜單
個人工具
登錄
名字空間
頁面
討論
變換
查看
閱讀
查看源代碼
查看歷史
操作
搜索
導(dǎo)航
首頁
社區(qū)專頁
新聞動態(tài)
最近更改
隨機頁面
工具箱
鏈入頁面
相關(guān)更改
特殊頁面
頁面信息
隱私政策
關(guān)于ALSROBOT WiKi
免責聲明