继电器:信号线接Arduino 10引脚,5伏接面包板,gnd接面包板,公共口接330欧电阻上,常开口接面包板上。
ard:gnd接led阴极,5v接面包板
led:阳极连在电阻上
int realy = 10;
void setup() {
// put your setup code here, to run once:
pinMode(realy, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(realy, HIGH);
delay(1000);
digitalWrite(realy,LOW);
delay(1000);
}