2 Questions - Wireless communication and SD card

Hey,

  1. Let's say I have an SD card shield, and I put an SD card with a sound on it into the shield. How do I program the Arduino to play that sound by it's name?

  2. I want to try simple wireless communication with IR emmiting and recieving diodes.
    I want to use two arduino board.
    the code for the emitter will be something like a blink with a 1mS delay. What is the code for the other one? I mean,
    if that pin is HIGH, than delay 1mS, than LOW and another delay.
    how do I write that code?
    on the normal 'if' I have () to put my condition, what if it's a big condition?

Thanks for your patients, time and forgivness for my spelling mystakes :wink: and sorry for digging!

  1. Let's say I have an SD card shield

OK. You have a SD card shield.

How do I program the Arduino to play that sound by it's name?

First, you add a Wave shield. Then, you move the SD card. Then you use the library that comes with the wave shield to play wav files.

Or, you get a Rogue Robotics shield that can play other types of sound files.

The Arduino can not decode any type of compressed audio file, and does not do a particularly good job reproducing sound anyway.

What is the code for the other one? I mean,
if that pin is HIGH, than delay 1mS, than LOW and another delay.

The first thing you have to do is read the IR receiver, and see if it is receiving anything.

what if it's a big condition?

Then you use big parentheses.

Two things with the SDcard: First you need a library to read the SD filesystem, there are several libraries available, but one already present in the Arduino distribution called "SD". Secondly you need to be able to decode the file format and pass it to some sound outputing device - this could be beyond the Arduino (don't expect to get a high data rate from the SD card, nor to be able to buffer audio in RAM given the tiny amount of RAM in the Arduino). Check out the Audio section of the forum for more approaches.

For IR communication sending is easy, its just flashing an LED, but receiving takes amplification and demodulating/decoding, which is a more complex area - some sort of amplifier circuit may be necessary to get the sensitivity you want - what sensitivity do you want?

I don't think were on the same page with the wireless communication.
I am going to use a light recieving diode, with only 2 legs, not an IR reciever, the diode shorts when IR light is near it and I connect it to the 5V to give a HIGH or LOW standart.
What about the code?

What about the code?

What about it?

int state = digitalRead(IRPin);

I need to right the statment that if it gets HIGH, delay (1), LOW, delay (1), HIGH, delay (1), LOW, delay (1)
than it triggers an LED on pin 13 or something, and that big IF won't go in the brackets ().

Will it be too much to ask the code?

I need to right the statment that if it gets HIGH

If what get HIGH?

if it gets HIGH, delay (1), LOW, delay (1), HIGH, delay (1), LOW, delay (1)

What does this mean? Are you trying to say that if a pin goes HIGH, stays HIGH for one millisecond, goes LOW, stays low for one millisecond, and then repeats that process, that you want to do something?

If so, what is making this pin do this?

Exactly. IF that pin (let's say digital pin 9) goes HIGH, stays HIGH for 1 millisecond, then goes LOW, stays LOW for 1 millisecond and repeat that process one more time, THEN it will make pin 13 HIGH.

pin 9 will be connected to an infra red light receiving diode which will give a HIGH every time it gets infra red light.
I'm gonna take another Arduino with an IR LED on it and make it do the actions above.

So, on each pass through loop, see if the pin is HIGH and was not last time. If so, a transition occurred, so record the time, using micros().

On each pass through loop, see if the pin is LOW and was not last time. If so, a transition occurred, so record the time.

If the interval is 1 millisecond (plus or minus), you are still on track for a complete cycle.

If you can get this much working, you can continue the process, timing how long the pin is low, then high, then low.

Thanks.
The cycle is the HIGH LOW HIGH LOW with delays in the middle?