實驗?zāi)康模?br /> 用金屬觸摸模塊和數(shù)字13 接口自帶LED 搭建簡單電路,制作觸摸提示燈。
器材:
Stduino UNO/Nano;杜邦線;金屬觸摸模塊
電路連接:
int LED = 13;
int BUTTON = 3;
int val;
void setup()
{
// put your setup code here, to run once:
pinMode(LED,OUTPUT);
pinMode(BUTTON,INPUT);
Serial.begin(9600);
}
void loop()
{
// put your main code here, to run repeatedly:
val = digitalRead(BUTTON);
if(val == HIGH)
{
digitalWrite(LED,LOW);
}
else
{
digitalWrite(LED,HIGH);
}
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |