完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好!我正试图让这个模块上的任何一个引脚变高。(大多数图像中没有 5V 输出)。
我的代码,使用 Arduino IDE,看起来像这样; 代码:全选 #include const char *ssid = "MYSSIDREMOVEDFORFORUMPOST"; const char *password = "LIKEWISE"; WiFiServer server(80); const int bourbon_pin(4); const int vermouth_pin(5); void setup() { Serial.begin(115200); delay(10); Serial.println(); Serial.println(); Serial.println("Manhattan project v1.0 - Geordie Guy 2020"); Serial.println(); Serial.print("Connecting to wifi network "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(); Serial.print("Connected to "); Serial.println(ssid); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.println("Starting server..."); server.begin(); Serial.println("Server started. Listening for command on port 80"); Serial.println(); Serial.println(); Serial.println("Setting up bourbon pump relay on GPIO 1 and sweet vermouth pump relay on GPIO 2"); pinMode(bourbon_pin, OUTPUT); pinMode(vermouth_pin, OUTPUT); digitalWrite(bourbon_pin, 0); digitalWrite(vermouth_pin, 0); Serial.println("Both pumps initaliased and set to off."); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data Serial.println("client connected, waiting for instructions"); while(!client.available()){ delay(1); } // Read the first line of the request String req = client.readStringUntil('r'); Serial.println(req); client.flush(); if (req.indexOf("/make") != -1){ Serial.println("Received instruction to make a Manhattan, running pumps..."); } else { Serial.println("Got an invalid instruction?"); client.stop(); } client.flush(); // Prepare the response String s = "HTTP/1.1 200 OKrnContent-Type: text/htmlrnrnrnrnMaking Drink "; s += "n"; // Send the response to the client client.print(s); delay(1); Serial.println("Client disonnected"); delay(1000); digitalWrite(bourbon_pin, 1); delay(1000); digitalWrite(bourbon_pin, 0); delay(1000); digitalWrite(bourbon_pin, 1); delay(1000); digitalWrite(bourbon_pin, 0); delay(1000); digitalWrite(bourbon_pin, 1); delay(1000); digitalWrite(bourbon_pin, 0); } 最后几行是尝试诊断,但是当我尝试检测每秒上升和下降的引脚时,我做不到。我究竟做错了什么?其余代码工作正常...... |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
968 浏览 1 评论
553浏览 6评论
463浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
447浏览 5评论
448浏览 4评论
418浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 16:55 , Processed in 0.746475 second(s), Total 77, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号