Using Sparkfun Transmitters

I have been trying to use the sample code from the KLP Walkthrough for the https://www.sparkfun.com/products/10534 and RF Link Receiver - 4800bps (434MHz) - WRL-10532 - SparkFun Electronics , but cannot seem to get it to work. I have checked to make sure everything is wired right, but was wondering if there is something in the code? What I want to be able to do is send numbers lets say 0-100 over the transmitter and have them be picked up by the receiver so that

if (incomingByte == 1){
    do something;
}
if (incomingByte == 2){
    do something else;
}

and so on...

Meanwhile on the transmitting end

if (Button1 == HIGH){
   outgoingbyte = 1;
}
if (Button2 == HIGH){
   outgoingbyte = 2;
}

This is the code that I have been working with

/*
* Simple Transmitter Code
* This code simply counts up to 255
* over and over
* (TX out of Arduino is Digital Pin 1)
*/
byte counter;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
counter = 0;
}
void loop(){
//send out to transmitter
Serial.print(counter);
counter++;
delay(10);
}

Receiving code

/*
* Simple Receiver Code
* (TX out of Arduino is Digital Pin 1)
* (RX into Arduino is Digital Pin 0)
*/
int incomingByte = 0;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
}
void loop(){
// read in values, debug to computer
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.println(incomingByte, DEC);
}
incomingByte = 0;
}

To quote the Sparkfun site:

Note: These modules are indiscriminate and will receive a fair amount of noise. Both the transmitter and receiver work at common frequencies and don't have IDs. Therefore, a method of filtering this noise and pairing transmitter and receiver will be necessary. The example code below shows such an example for basic operation. Please refer to the example code and links below for ways to accomplish a robust wireless data link.

In other words you can't just expect UARTs to receive the signal cleanly - it may have noise spikes.

BTW what antennas are you using? I'd recommend starting with 17cm quarter-wave wire on the receiver, and on the transmitter too if any distance apart. If they are really close they antenna won't be needed.

I had not planned on using antennas since the range will never be greater than 20ft. Do you have any other suggestions for filtering the noice? Thanks

You need antennas for that distance. I was assuming you might be testing on one breadboard and be at risk of overloading. Get good signal strength and there will be less noise. If the receiver is near a computer it will pick up a lot of noise from it BTW.

I note on the receiver datasheet that the antenna they recommend is 13cm - this means the input impedance is not the standard 50 or 75 ohms and it is quite likely the wrong length of antenna will de-tune the receiver. Follow the datasheet recommendations, run a 13 cm wire from the antenna pin away from all other metal. Tuning with the tuning cap may also be needed to get maximum signal

Bear in mind this style of transmitter receiver pair is the most basic possible and has very low selectivity, and especially poor noise immunity
since there doesn't appear to be any significant out-of-band filtering.

I had not planned on using antennas since the range will never be greater than 20ft.

Without an antenna, 20 millimeters is a stretch.

You should consider connecting the transmitter and receiver to other pins, and using SoftwareSerial to talk to them, leaving the hardware serial port free for debugging.