如何解决通过互联网发送通过Arduino Due播放语音备忘录
我正试图让一个带有W5500以太网屏蔽的Arduino播放录制的语音备忘录,该备忘录通过UDP发送给它。 目前,我在C#中有一个WAV记录器。我的计划是将wav转换为字节数组并发送,但是我的Arduino将不会响应我发送的任何内容(通过Programm Packet Sender进行尝试)。通过串行监视器,我只能得到UDP Rdy返回。
我的Arduino暂时具有此代码
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet2.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp2.h>
#include <util.h>
byte mac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,0xED };
IPAddress ip(192,168,1,200);
IPAddress gateway(192,1);
IPAddress subnet(255,255,0);
unsigned int localPort = 2014;
EthernetUDP Udp;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];
void setup() {
// put your setup code here,to run once:
Ethernet.init(10);
Serial.begin(115200);
Ethernet.begin(mac,ip);
Udp.begin(localPort);
Udp.flush();
Serial.print("UDP Rdy");
}
void checkUDP()
{
int packetSize = Udp.parsePacket();
if(packetSize>0)
{
Serial.print("Begin");
Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE);
Serial.print("Packet Content: ");
Serial.println(packetBuffer);
Udp.beginPacket(Udp.remoteIP(),Udp.remotePort());
Udp.write("ok");
Udp.endPacket();
}
delay(10);
}
void loop() {
// put your main code here,to run repeatedly:
checkUDP();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。