Infrared Transmitter and Receiver.

Hi i would like to take data i put into the serial port aka Serial.read and turn it into morse code. Then have another Arduino have an infrared receiver on it and have it translate the morse code into word and print it in the serial port. If anyone has any info on how i can accomplish this, it would be greatly appreciated.

hmm, interesting idea...

perhaps you could turn the data into binary, 1's and 0's, then output the code using an IR transmitter - 1's for on, 0's for off... then the IR receiver gets the same on/off pattern, turns it to 1's and 0's, and then have serial.print turn this binary data into what you originally printed into the serial port...

Hi i would like to take data i put into the serial port aka Serial.read and turn it into morse code.

Create some sort of morse interpreter, maybe hack the wellknown library tutorial? Or see this: http://en.wikipedia.org/wiki/Morse_code

Then have another Arduino have an infrared receiver on it and have it translate the morse code into word and print it in the serial port.

Make some sort of IR protocol, and use the recieved data, pass it through your morse interpreter, and print to the serial.

If anyone has any info on how i can accomplish this, it would be greatly appreciated.

The obvious: 2 x Arduinos 1 x IR transmitter 1 x IR reciever

I recommand you dividing this problem into several problems:

1) make a text to morse library.
    For instance:
      + toMorse(char* original, char* morse);
      + toString(char* morse char* original);
2) make or use a IR communications library
3) patch it together

For the transmitter program, how about something like this? By the way the 10011 mean nothing just random..

int irpin = 13;

void setup() { pinMode(irpin, OUTPUT); }

void loop() { zero(); one(); zero(); one(); one(); delay(3000); }

void zero() {

digitalWrite(irpin, LOW); delay(1000); }

void one() { digitalWrite(irpin, HIGH); delay(1000);

}

Two questions:

1: Have you made a libray before? If not, look here: http://arduino.cc/en/Hacking/LibraryTutorial http://www.arduino.cc/playground/Code/Library

Very helpful when making project a bit larger than making LED @pin 13 blink ;)

2: Do you need/want the IR signals that are transmitted to represent morse directly? That is: Do you want the resulting IR pattern/signal valid morse code?

For now ill use binary as someone mentioned before. It is a little easier. My program will work but i just need to convert the words to binary then execute it with one() or zero().

What should the receiving program look like?

i win :)

If you go to the home page (www.arduino.cc) and type in "Morse Code" in the search box, you'll find some examples that people have written for both sending and receiving Morse.

You can also find info on how to do the hardware by searching for "infrared".

Ran

Um, what did you find on receiving programs, i could not find any.

I think Ran Talbott was refering to this: http://arduino.cc/en/Hacking/LibraryTutorial I might be wrong though.

Playground Resource on Visual Sensing

Robotkid, is google broken where you are? http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231030684

“For now ill use binary as someone mentioned before. It is a little easier.”

I want to use on off signals, 1s and 0s, sorry for the miscommunication.

For a receiving program using on off signals, this is the program i wrote.

int VALUE = 0;

void setup() { }

void loop() { int VALUE = analogRead(0);

readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne; readZero; readOne;

}

void readOne() { if (VALUE = HIGH) { Serial.print("1"); delay(10); } else { delay(10); }}

void readZero() { if (VALUE = LOW) { Serial.print("0"); delay(10); } else { delay(10); }

}

For a transmitting program,

int irpin = 13;

void setup() { pinMode(irpin, OUTPUT); }

void loop() { zero(); one(); zero(); one(); one(); delay(3000); }

void zero() {

digitalWrite(irpin, LOW); delay(10); }

void one() { digitalWrite(irpin, HIGH); delay(10);

}

Robotkid, I’m having real problems understanding your sense of humour.

What don’t you understand about scope?

int VALUE = 0;

void setup() {
}

void loop()
{
 int VALUE = analogRead(0);
 
 readZero; readOne;
  readZero; readOne;
   readZero; readOne;
    readZero; readOne;
     readZero; readOne;
      readZero; readOne;
       readZero; readOne;
        readZero; readOne;
         readZero; readOne;
          readZero; readOne;
           readZero; readOne;
            readZero; readOne;
             readZero; readOne;
              readZero; readOne;
               readZero; readOne;
                readZero; readOne;
                 readZero; readOne;
                  readZero; readOne;
                   readZero; readOne;
                    readZero; readOne;
                     readZero; readOne;
                      readZero; readOne;
                       readZero; readOne;
                        readZero; readOne;
 
}



void readOne() {
 if (VALUE = HIGH) {
   Serial.print("1");
   delay(10);
}
else {
 delay

There is a rule with software. If you find yourself writing the same thing or nearly the same thing over and over you are doing it wrong.

In this case you need to learn about "for loops"

You have a lot of code that does such a little work.

You have a lot of code that does such a little work.

"little" == zero.

I was trying to be kind. ::)

How do for loops work?

ok, first off, 1 and 0's = binary...

and the for loop is conveniently described here:

http://www.arduino.cc/en/Reference/For

I am the biggest idiot ever, i see what you guys were saying.