0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« on: December 07, 2009, 04:15:33 pm » |
Hello all i am testing out the code for the Arduino Wave shield. However, whenever i try to compile the code, it tells me that my AF_Wave.h is not in the directory. And i know i copied the AF wave library AND the waveHC into the hardware of the program. So it should technically work. Here is my code #include <AF_Wave.h> #include <avr/pgmspace.h> #include "util.h" #include "wave.h"
AF_Wave card; File f; Wavefile wave; // only one!
#define redled 9
uint16_t samplerate;
void setup() { Serial.begin(9600); // set up Serial library at 9600 bps Serial.println("Wave test!");
pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(redled, OUTPUT); if (!card.init_card()) { putstring_nl("Card init. failed!"); return; } if (!card.open_partition()) { putstring_nl("No partition!"); return; } if (!card.open_filesys()) { putstring_nl("Couldn't open filesys"); return; }
if (!card.open_rootdir()) { putstring_nl("Couldn't open dir"); return; }
putstring_nl("Files found:"); ls(); }
void ls() { char name[13]; int ret; card.reset_dir(); putstring_nl("Files found:"); while (1) { ret = card.get_next_name_in_dir(name); if (!ret) { card.reset_dir(); return; } Serial.println(name); } }
uint8_t tracknum = 0;
void loop() { uint8_t i, r; char c, name[15];
card.reset_dir(); // scroll through the files in the directory for (i=0; i<tracknum+1; i++) { r = card.get_next_name_in_dir(name); if (!r) { // ran out of tracks! start over tracknum = 0; return; } } putstring("\n\rPlaying "); Serial.print(name); // reset the directory so we can find the file card.reset_dir(); playcomplete(name); tracknum++; }
void playcomplete(char *name) { uint16_t potval; uint32_t newsamplerate; playfile(name); samplerate = wave.dwSamplesPerSec; while (wave.isplaying) { // you can do stuff here! delay(500); } card.close_file(f); }
void playfile(char *name) { f = card.open_file(name); if (!f) { putstring_nl(" Couldn't open file"); return; } if (!wave.create(f)) { putstring_nl(" Not a valid WAV"); return; } // ok time to play! wave.play(); }
any suggestions?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35483
Seattle, WA USA
|
 |
« Reply #1 on: December 07, 2009, 04:51:34 pm » |
The library should be in the Hardware/libraries folder, not the hardware folder. Is that a typo?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #2 on: December 07, 2009, 05:01:49 pm » |
ah yes i apologize. I meant to say its in the Hardware/library.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #3 on: December 07, 2009, 08:12:32 pm » |
alright update
so i needed to open the file via the arduino shortcut folder, and i avoided that error. Hooray!
now i have it all successfully downloaded, but when i try to execute the code and look through the serial monitor, i keep getting the error:
Wave test! Free RAM: 1191 No valid FAT partition!
SD I/O error: 10, 80
anyone know what that means?
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Offline
Faraday Member
Karma: 33
Posts: 3619
@ssh0le
|
 |
« Reply #4 on: December 07, 2009, 08:13:36 pm » |
how big is the card, and how is it formatted
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #5 on: December 07, 2009, 08:35:42 pm » |
The SD card is a mini 2 GB and its FAT 16 formatted i basically followed it according to this site here: http://www.ladyada.net/make/waveshield/formatcard.htm
|
|
|
|
|
Logged
|
|
|
|
|
North Yorkshire, UK
Offline
Faraday Member
Karma: 104
Posts: 5531
|
 |
« Reply #6 on: December 08, 2009, 06:05:23 am » |
I would first try FAT formatting it. Maybe the card is not reading properly.
Mowcius
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #7 on: December 08, 2009, 05:40:32 pm » |
hmm i have done that... and the funny part is, we tried it with my friend's mac, with the EXACT configurations and setup and it worked perfectly.
could the problem be my pc laptop then?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35483
Seattle, WA USA
|
 |
« Reply #8 on: December 08, 2009, 07:05:36 pm » |
we tried it with my friend's mac You tried what? Formatting the SD card?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #9 on: December 08, 2009, 07:11:58 pm » |
lol we tried the whole wave shield arduino and code and ran it on the MAC, and the sound system worked perfectly.
|
|
|
|
|
Logged
|
|
|
|
|
North Yorkshire, UK
Offline
Faraday Member
Karma: 104
Posts: 5531
|
 |
« Reply #10 on: December 09, 2009, 03:43:31 am » |
Maybe you modified some code by accident on the windows laptop before you uploaded it. I suggest now you know it works you try again on the windows laptop.
It would be good to find out what the issue was/is in case someone else has the same problem. Have you looked on the waveshield page to see if there are any bugs reported relating to your problem?
Mowcius
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #11 on: December 09, 2009, 11:06:01 am » |
hmmm
i went ahead and tried to modify a couple of things in the code itself.
i changed the code from this: if (!card.init()) {//play with 8 MHz spi to
if (!card.init(true)) {//play with 4 MHz spi
and i still get
No valid FAT partition!
SD I/O error: 10, 7F
the only thing i can think of is make it a FAT32 which you are NOT suppposed to do...but i am running out of options
|
|
|
|
« Last Edit: December 09, 2009, 12:32:36 pm by haukmoon269 »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #12 on: December 09, 2009, 01:37:19 pm » |
i even ran a test an SD_read test and it gave me this error
init time: 38
Card type: SD1
Manufacturer ID: 6F OEM ID: Product: SMI Version: 1.0 Serial number: 369557504 Manufacturing date: 1/2003 card size: 3920896 (512 byte blocks) partion,boot,type,start,length read partition table failedSD error errorCode: 10 errorData: 0
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 52
Arduino rocks
|
 |
« Reply #13 on: December 09, 2009, 08:01:47 pm » |
alrighty then
after browsin around a bit, i had the idea to change my SD card to a different one. and it worked. I guess some SD cards are better than others. So i guess for anyone out there that is experiencing this problem, you might want to try other SD cards.
thanks for all the input!
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35483
Seattle, WA USA
|
 |
« Reply #14 on: December 10, 2009, 06:01:00 am » |
There are definitely differences between SD cards, and some work with the various libraries/hardware, and some do not. Since they all seem to work in the computer, it would be nice to track down the source of the problem, and try to correct it. Whether that means a change to the libraries or to the hardware I do not know.
You showed data for a card that did not work. Could you show the same data for the card that did work?
|
|
|
|
|
Logged
|
|
|
|
|
|