What does "ls()" do?

Hi, am quite new to Arduino and have been playing around with the Wave Shield from Lady Ada and the AF_Wave libraries. i was wondering, can anyone explain what "ls()" does?

don't know check the code in the lib.

ls is the unix equiv of dir but ?

Thanks, but my problem is that I can't find any reference to it in any of the libraries. You wouldn't happen to know where it is defined would you?

It’s time to turn the tables. Why are you asking about this function? How do you know of it’s existence? Since there is no xx. or xx-> in front of the function in your question, it implies that the function does not live in a class. Therefore, it is likely that the function is local in a sketch, and we have no idea what sketch you are looking at.

I am looking at the AF_Wave libraries downloaded from ladyada. The sketch is the PlayAllLoop example that comes with these libraries. I am trying to see if I can create a layer of abstraction and thus hide bits such as the error checking and SD card initialise code. I am nearly there but as soon as I try and move the "ls()" and "void ls()" bits the compiler tells me that "ls" is not declared in the scope. I realise that I may have bitten off more than I can chew but any help you could give would be brilliant.

I am nearly there but as soon as I try and move the "ls()" and "void ls()" bits the compiler tells me that "ls" is not declared in the scope.

If you have an existing function, in a sketch, then it should have been pretty easy to see what that function does.

If is wasn't apparent, you should have posted the function, defined where you got it, and then asked "what does this function do?".

OK, I'm over it.

Well, not exactly, because you are doing the same thing again. Where did you move the ls() call to? Where did you move the ls() function to?

The forum is a non-profit organization. Salaries are terrible. We couldn't keep up the payments, so our crystal ball was repossessed.

You have to help out by posting some code, and the error messages that the compiler produces when you try to compile the code.

Niknik, The ls() function is defined in the PlayAllLoop example, NOT in any of the libraries. It apparently lists the files contained on the SD/MMC memory card that's connected to the Wave Shield out to the Serial port. If you're getting that ls() is not defined then you haven't copied over the function to your own code. It's best to put it up in the source code BEFORE you actually use it. ls() is already a bit of an abstraction over the raw get_next_name_in_dir() although it sends it's output to the Serial port. This might not be what you want if, say, you'd like to put the file names up on some sort of display.

PaulS, Please get over it. Niknik gave us plenty of information and he didn't need to post all of his code for a helpful answer to be given. Not being familiar with Lady Ada's website I simply put "Wave Shield Lady Ada" into Google, got the download, and searched it -- 30-seconds, tops! It took me a bit longer to write the reply above.

-Rusty-

Please get over it. Niknik gave us plenty of information and he didn't need to post all of his code for a helpful answer to be given. Not being familiar with Lady Ada's website I simply put "Wave Shield Lady Ada" into Google, got the download, and searched it -- 30-seconds, tops! It took me a bit longer to write the reply above.

But, Niknik already had the code he/she was asking questions about. This forum works better when too much information is provided than when too little information is provided.

If you don't have the hardware in question, and don't have a need for the libraries that go with it, it seems unnecessary to have to download the zip file, unzip it, hunt up the portion of the sketch in question, post an answer, then delete the unzipped files and the zip file, when OP could simply have copied the code he/she was looking at in the browser.

But, since OP has posted plenty of information, how do you propose to solve the problem that he/she last posted about? Hmmm, maybe not enough information, after all.

Rusty in Texas

Thank you so much for your reply to what has been pointed out as too little information. You have no idea how helpful your answer is.

PaulS I am sorry I haven't posted the code yet but I did have my reasons. I am extremely new to this, I consider myself to have no more than a basic understanding of coding, I am therefore learning as I go. I don't actually want a solution just at the moment I just need info on little bits to help me learn and check my understanding, I don't imagine my task will be finished in a hurry but hopefully I will learn a lot while I'm doing it.

However, thank you for showing an interest and I promise I'll post some code next time for you to take a look at :)

Niknik, Glad to be of service. Hopefully you will get your program working the way you want.

PaulS, I couldn't agree with you less. Some people believe that people need to post all their code, all the time, to make this forum work better. Quite frankly, I find that somewhat intrusive but SOMETIMES it may be needed. Certainly a lot of that will depend on the quality of the question and the knowledge if the OP. Nonetheless, until you saw the example code from Lady Ada's library all you could have said was the ls() had not been defined and the OP would have to go look for it or write it. That certainly would not have answered his question about the functionality of ls() at all.

And honestly, I don't find it seemingly unnecessary to download a 34KB file and do a quick look-see through it. If it were a couple of meg then I might agree with you, but here again I don't. And having the OP copying all his code still wouldn't have answered his questions. That wouldn't have been much help, now would it? I'm sorry doing such a small download is too much trouble for you. And I don't have the hardware either.

Now, did the OP post plenty of information? In thus case I believe that the answer is obviously yes, given his reply above, and I did manage to help him with his problem and he's happy, As we say here in Texas Paul, yer tall horse is looking more like a Shetland.

Bravo, Rusty! I've been on this forum for a couple of months now and cringe at some of the replies I read. It seems there are several "God Members" who delight in belittling newbies more than helping them.

I'm not sure why you (either of you) think that asking for all the information required to solve a problem is belittling or harassing newbies. If you thought that there was enough information presented to answer OP's question, then why didn't you answer it?

Well, being a newbie myself I would not know if there was enough information or not. But if I was in a position to know I would just simply state that I needed more info. If I was aggravated by the questioner I would not reply at all and wait for someone with more patience to deal with it.

Hey Paul, my thingee isn’t working right. Can you help me with it?

Lefty

Bravo, Rusty! I’ve been on this forum for a couple of months now and cringe at some of the replies I read. It seems there are several “God Members” who delight in belittling newbies more than helping them.

You want real ‘belittling’ just try and post an incomplete question over on the AVRfreaks site ( http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index ) , You will be back in a flash for the kind of help given to beginners here.

Lefty

You want real 'belittling' just try and post an incomplete question over on the AVRfreaks site

Brrrr... I can feel the chill from here! :D

I'm not sure why you (either of you) think that asking for all the information required to solve a problem is belittling or harassing newbies. If you thought that there was enough information presented to answer OP's question, then why didn't you answer it?

@Paul, Get it straight -- I never said asking for "all" the information (allegedly required) to solve a problem is belittling or harassing -- someone else opined that one. I said I thought it was somewhat intrusive but sometimes it was needed. In all the years I've been helping folks with computer questions I have never asked, up front, before even looking at the problem, for ALL the information. I usually have to pry some of it out at times but I start piecing the puzzle together and ask for info as I go along.

And I did answer most of the OP's questions; certainly the one about "what does ls() do?" and the question about his "function not declared in scope". Were there really more? While I didn't tell the OP exactly where his problem with ls() was located he certainly seemed pleased with my answer and able to move on in his learning. So the OP provided MORE THAN ENOUGH information (at least for me, obviously not for you) and he didn't need to kiss your ring to get some answers. And if Niknik has more questions, hopefully he won't be fearful of returning and asking again.

Better get off your Shetland pony, Paul -- yer feet are dragging!!!

@Lefty and Badly, It's been a bit since I was on the forums over at AVRFreaks. Sorry to hear that it has denigrated to such silliness. There was a TI MSP430 mailing list I was on that had more bickering than I wanted to put up with (and not because of TI).

Just to clarify my previous posts, I was not criticizing Paul for wishing the poster had provided more information, only for his tone. Maybe I’m just an old fart who doesn’t understand the new culture but I believe public discourse has become increasingly rude and “snarky”.
Yes, I understand there are people who come to these forums expecting to be handed a complete solution to their problem without doing any work but there are also those who ask questions without knowing what information would be needed. I am grateful there are people who know more than me who are willing to help me learn. I am new to this forum but I’ve spent a lot of time at CNCzone.com where the tone is quite different.
Again, I’m grateful to Paul and all the others who take the time to help the rest of us. It’s just that I believe snarkiness is unnecessary and counter-productive.

Maybe I'm just an old fart who doesn't understand the new culture but I believe public discourse has become increasingly rude and "snarky".

For an old fart just an example of the snarkiness in public speech pre-dating even you. Sarcasm might not be nice, but if it keeps us either amused or incites the other side to post better questions, why not. In the end, we're not getting paid for all this.

Korman

Well, if it amuses you, go right ahead! ;)