arduino+继电器 不上220v怎么试怎么好 一上强电怎么试怎么废
用的13引脚,串口发个o就吸合10秒
不插220v怎么试怎么好 结果这会接上220v的电 能动作一次 然后arduino就死机非要重新插拔才能用第二次 然后再死机
是因为继电器质量问题吗?
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- pinMode(13, OUTPUT);
- digitalWrite(13, LOW); // 使Led灭
- }
- void loop() {
- // put your main code here, to run repeatedly:
- if (Serial.read() == 'o') {
- delay(1000); // 延时1秒钟
- digitalWrite(13, HIGH);
- delay(10000); // 持续10秒钟
- digitalWrite(13, LOW);
- }
- delay(1000);
- }
复制代码 |