Can someone point me to a code to light LED wirelessly?

Hey,

Can someone point me to a code on how to light up an LED wirelessly. I am using 2 transceiver connected to 2 separate arduino uno boards.

thanks

Ok so what you will need is one board to send the signal and one board to receive the signal. You will need to different programs

I have never done this but I think this will work.

This one go's to the Arduino that dosn't have the LED

void setup() {
    Serial.begin(9600);
}

void loop() {
    delay(5000);
    Serial.println("a");
    delay(5000);
    Serial.println("b")
}

This is the code for the Arduino with the LED

int ledpin = 13;
void setup() {
    pinMode(ledpin, OUTPUT);
    Serial.begin(9600);
}

void loop() {
if (Serial.available() > 0) {
    if (Serial.read() == "a")
        digitalWrite(ledpin, HIGH);
    if (Serial.read() == "b")
        digitalWrite(ledpin, LOW);
}
}

This is what I would try first. It is hard for me to write code for something when I don't have it in front of my so it may not work. Hope it works post back telling me if it does.

What about the receiver side code? How should it be?

Sorry lol I accidentally posted before I was done. I'm done now.

Thanks alot. Will try it out. :)

    if (Serial.read() == "lighton")

Will never be true. Serial.read() returns a single byte, or -1 if there is nothing available.

Send and receive a single character, 'n' or 'f' for o*n* or of*f*, for example. Check Serial.available() first.

dxw00d is correct follow what he said. Like I said I haven't written a program for an Arduino in a while and I have been programming in other languages so I guess I got a little confused lol sorry about that I will try fix the code above. Thanks for the help dxw00d

I am using this transceiver (http://docs-asia.electrocomponents.com/webdocs/0d71/0900766b80d71643.pdf), do I need a special library to interface with arduino for it?

Thanks

I honestly don't know about this one. I'm just going to leave this for someone else to answer lol!

Looks like a nice module. Doesn't appear to need a library.

On the transmit side, is just missing a ; at the end

void setup() {
    Serial.begin(9600);
}

void loop() {
    delay(5000);
    Serial.println("a");
    delay(5000);
    Serial.println("b");
}

On the receive side, change to this:

int ledpin = 13;
byte incomingByte = 0;
void setup() {
    pinMode(ledpin, OUTPUT);
    Serial.begin(9600);
}

void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();  // read in the received byte
    if (incomingByte == "a"){     // and act on it here
        digitalWrite(ledpin, HIGH);
}
    if (incomingByte == "b"){    // or act in it here
        digitalWrite(ledpin, LOW);
}
}
}

Ooops lol I forgot that ; but thanks now I see what I did wrong the first time!

incomingByte == "a"

should be

incomingByte == 'a'

and the same for b

This is because things in " quotes are strings and single ' quotes are characters.

Looks like its been a while since I sent characters as well!

The transceiver model has a function where you can configure it. Do I really need to change anything there to interface with arduino. I am asking this because I dont have the evaluation board to configure it incase I need to change any settings. And I don't have a clue on how I can configure it using arduino.

When I emailed the vendor they said I can use a pic-controller if I don't have evaluation board to configure, but didnt explain how to. If someone can figure out how I can configure it using arduino would greatly appreciate it.

Thanks

The link previously given for datasheet of the module wasn't correct. Now it has been changed to the correct one. Sorry.

I would think it should work with the default settings. Note that Vcc is 3.3 volts (Vccmax is 3.6v), and there is a decoupling capacitor required between Vcc and ground.

In case I want to play around with the configuration how can I go around with it, if I don't have the evaluation board. Can I use arduino to send +++ to go into the configuration mode?

Yes, you can, bearing in mind that it is a 3.3 volt part, and can't be driven directly from the Arduino's serial pins. Once voltage matching is sorted, you can just Serial.print() the +++.

The arduino Uno has Vin pin of 3.3V. I was thinking of using that pin to power up the transceiver. So, according to datasheet do I need to send Hex values or binary to the transceiver to configure it. Because the transceiver has 0-14 byte configuration, and thats 120 bits. So, do I need to send 120 bits in order to configure it.

The Arduino serial pins are 5 volts. The data pins on the transceiver have a 3.6 volt maximum limit. In fact, all the pins have a 3.6v maximum.