he everyone i' m working in a project
and part of this project is sending .wav file from Arduino to other Device ( for example other Arduino)
i already was able to send .txt file from an SD which was included in the Ethernet Shield
to other Arduino SD card , but it doesn't work when i try to send .wav
any idea ?
void loop() {
if(digitalRead(push1) == LOW){
writeanddeletSDcard();
Serial.println("i will send now");
Udp.beginPacket(destIp, port);
Udp.write(a);
Udp.endPacket();
Serial.println("Sending UDP message");
}
}
void writeanddeletSDcard(){
SD.remove("S13.txt");
myFile = SD.open("S13.txt", FILE_WRITE); // boolean
data = myFile.size();
// if the file opened okay, write to it:
if (myFile) {
Serial.println("i will Write now ");
delay(2000);
Serial.println(data);
myFile.println("HELLO WORLD");
myFile.close();
// close the file:
}
else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");}
// ---------------- here end of Writing an a massege on the SD Card
// re-open the file for reading:
myFile = SD.open("S2.WAV");
if (myFile) {
Serial.println("inside the file there's");
c= 0 ;
// read from the file until there's nothing else in it:
while (myFile.available()) {
a[c] = myFile.read();
c++;
}
Serial.println(c);
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}