极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11631|回复: 0

arduino yun 关闭wifi

[复制链接]
发表于 2014-5-20 16:11:44 | 显示全部楼层 |阅读模式
试着写了一段代码:
  1. #include <Process.h>
  2. int startPin = 7;
  3. int stopPin = 6;
  4. String strstart = "echo -n 'start' | socat - udp-connect:192.168.0.25:60002";
  5. String strstop = "echo -n 'stop' | socat - udp-connect:192.168.0.25:60002";
  6. void setup() {
  7.   pinMode(startPin, INPUT);
  8.   pinMode(stopPin, INPUT);
  9.   Bridge.begin();
  10. //  Serial.begin(9600);
  11. }

  12. void loop() {
  13.   Process p;
  14.   digitalWrite(startPin,HIGH);
  15.   digitalWrite(stopPin,LOW);
  16.   p.runShellCommand(strstart);
  17.   delay(3000);
  18.   digitalWrite(startPin,HIGH);
  19.   digitalWrite(stopPin,LOW);
  20.   p.runShellCommand(strstart);
  21.   delay(3000);
  22. }
复制代码
然后把wifi关了,断电重启,刚开始可以控制继电器,能ping通,但1-2分钟后继电器停止工作,ping也ping不同....

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-14 19:42 , Processed in 0.040567 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表