硬體位置
工作接腳PIN13控制內建LED
閃爍
void setup() {
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
}
void loop() {
}
閃爍3下
void setup() {
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
void loop() {
}
一直閃爍
void setup() {
pinMode(13,OUTPUT);
}
void loop() {
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
數位訊號讀取 digitalRead(7)怎麼用
void setup() {
pinMode(7,INPUT);
pinMode(13,OUTPUT);
}
void loop() {
if(digitalRead(7)==HIGH){
digitalWrite(13,HIGH);
}
else{
digitalWrite(13,LOW);
}
}