This code should work with my RF link right?

Hi guys first post on here. Trying to set up a super basic program that transmits a byte over 315MHz RF and a receiver receives this byte and in turn blinks an LED. I am using a 328 on a boarduino and a 168 on a bread board. The transmitter is outputting something (an LED hooked up to the DATA pin blinks rapidly) and the receiver is receiving something in the same manner. Problem is the main LED on pin 9 isn't blinking as I have called for it to. Mind troubleshooting my code if thats where the error is? Thanks!

/* Transmit program for 315 MHz RF link
written by Bryan 11-4-09
*/
int rxPin = 2;
int txPin = 3;

void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(1200);
}
void loop()
{
byte blink = 1;
Serial.print(blink);
delay(50);
blink = 0;
Serial.print(blink);
delay(50);
}

==========================================

/* Receive program for 315 MHz RF link
written by Bryan 11-4-09
*/
int rxPin = 2;
int txPin = 3;
int led = 9;

void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(1200);
}
void loop()
{
byte blink = Serial.read();
if (blink = 1)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
}

next time you post please use the # icon in the editor and put your code tween the tags, it makes it easier to read

byte blink = 1; in the first sketch should be declared outside of the loop

byte blink;

void loop()
{
    blink = 1;
    ect();
}

and try using Serial.write instead of Serial.print

will do thanks. unfortunately nothing you suggested worked, any other thougths?

(creating a byte called blink in the loop is perfectly fine, it just cant be used anywhere else)

 if (blink [glow]==[/glow] 1)
if (blink = 1)

Is always true. Should be "=="

[edit]Hah! Beaten to the draw! Also, have a look at the VirtualWire libraries.[/edit]

dang it, n00b mistake, i new that :P. Thanks for pointing it out, i will be sure to look into the virtualwire libraries and let you know if i can get it working!

Well the problem is .. this probably wouldn't work unless the pair was like... literally centimeters away, because the receiver would be receiving random noise from anything and everything else, so you'd never get a complete message of what you wanted.. VirtualWire is definitely something to look into, super easy, and it handles all the garbage and what not, so you only receive what you send.

And it's fairly easy to use, can use any pin. :slight_smile:

The transmitter is outputting something (an LED hooked up to the DATA pin blinks rapidly) and the receiver is receiving something in the same manner.

Is your 315MHz Tx/Rx pair intended for communicating datastreams, or is it simply for remote control signal/switching?

If it is the latter, I suspect the Rcvr output pin would just shift logic levels. True? So you would not need 'serial'. Just read digital levels. (I mention as I am playing with an RF pair that uses 2622/2722 encoder/decoder).