Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Audio 通过互联网发送的Arduino播放语音备忘_Audio_Arduino_Udp_Ethernet - Fatal编程技术网

Audio 通过互联网发送的Arduino播放语音备忘

Audio 通过互联网发送的Arduino播放语音备忘,audio,arduino,udp,ethernet,Audio,Arduino,Udp,Ethernet,我试图让一个带有W5500以太网屏蔽的Arduino播放通过UDP发送到它的录音语音备忘录。 目前我有一台C#的wav录音机。我的计划是将wav转换成字节数组并发送它,但我的Arduino不会响应我发送的任何东西(通过程序包发送器尝试)。通过串行监视器,我只得到UDP Rdy返回 我的Arduino现在有这个密码 #include <Dhcp.h> #include <Dns.h> #include <Ethernet2.h> #include <Eth

我试图让一个带有W5500以太网屏蔽的Arduino播放通过UDP发送到它的录音语音备忘录。 目前我有一台C#的wav录音机。我的计划是将wav转换成字节数组并发送它,但我的Arduino不会响应我发送的任何东西(通过程序包发送器尝试)。通过串行监视器,我只得到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, 168, 1, 1);
IPAddress subnet(255, 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();
   
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
字节mac[]={0xDE,0xAD,0xBE,0xEF,0xFE,0xED};
ip地址ip(192、168、1200);
IP地址网关(192、168、1、1);
IP地址子网(255、255、255、0);
unsigned int localPort=2014;
以太网Udp;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];
无效设置(){
//将安装代码放在此处,以便运行一次:
Ethernet.init(10);
序列号开始(115200);
以太网开始(mac,ip);
开始(localPort);
Udp.flush();
串行打印(“UDP Rdy”);
}
void checkUDP()
{  
int packetSize=Udp.parsePacket();
如果(packetSize>0)
{
串行打印(“开始”);
读取(数据包缓冲区、Udp_发送_数据包最大大小);
串行打印(“数据包内容:”);
Serial.println(packetBuffer);
Udp.beginPacket(Udp.remoteIP(),Udp.remotePort());
Udp.write(“ok”);
Udp.endPacket();
}
延迟(10);
}
void循环(){
//将主代码放在此处,以便重复运行:
checkUDP();
}