Re: RF Modules

Now I could be wrong but its called by vw_send() only to clear the deck before transmitting.

I notice also that all the example programs have it in just after the send .

Maybe there's a reason for that.
You need to read C.A.R. Hoare's "Communicating Serial Processes"

You also need to use the "code" (#) key when posting code.

BTW, you posted the receiver sketch twice in your previous thread.
Could you perhaps post the transmitter sketch, and then we can look at your problem from both ends?
It looks like you're maybe mishandling a float (floats are 4 bytes long, and 0xf4, 0xef, 0x B0, 0x41 == 22.12???), but it's difficult to tell without both halves of the code.
Thanks.

I went to modify the first post and deleted it accidentally.

There is a problem getting on to the previous thread for me -perhaps due to the long title messing something up so I'll continue here .
Here's both programs again as they stand now and they are messy I know with the stuff I am using to see whats going on still in them.

#include <NewOneWire.h>
#include <DallasTemperature.h>
#include <VirtualWire.h>
//transmits on pin 12 by default
// Data wire is plugged into port 8 on the Arduino
static const int ONE_WIRE_PIN = 8;
NewOneWire oneWire(ONE_WIRE_PIN);
DallasTemperature tempSensor(oneWire);

void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
tempSensor.begin();
Serial.println("Dallas Temperature IC Control Library");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100 -turns radio off
vw_setup(2000); // Bits per sec
}
void loop()
{ // getTemperature returns a float.
float temperature = tempSensor.getTemperature(); //default C
int temp = temperature * 1000 ;
//Get stuff
char msg[] = "Hello there";
unsigned char addr[8];
for (uint8_t i = 0; i < 8; i++) {
addr_=tempSensor.getSlaveAddr(), HEX;_
* }*
* uint8_t index = tempSensor.getIndex(); *

* switch(tempSensor.isValid())*
* { case 1:*
* Serial.println("Invalid CRC");*
* tempSensor.reset(); // Attempts to redetect IC*
* return;*
* case 2:*
* Serial.println("Not a valid device");*
* tempSensor.reset(); // Attempts to redetect IC*
* return;*
* }*

* //Send stuff*
* digitalWrite(13, true); // Flash a light to show transmitting*
* vw_rx_start(); // Start the receiver PLL running*
* uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;*

vw_send((uint8_t *)msg, strlen(msg));
vw_send((uint8_t *)index,1);
vw_send((uint8_t )addr,8);
vw_send((uint8_t )temp, 1);
vw_wait_tx(); // Wait until the whole message is gone

* //Serial stuff*
* Serial.println(msg);*
* Serial.println((int)index);*
* for (uint8_t i = 0; i < 8; i++) {
_ Serial.print(addr,HEX);
Serial.print(" ");}
Serial.println();
Serial.print("temperature ");
Serial.print(temperature);
Serial.println("C\t");
Serial.println(temp);
Serial.println(sizeof (temp));
digitalWrite(13, false);
Serial.println("Message Sent");
Serial.println();*_

* if (vw_get_message(buf, &buflen)) // Non-blocking*
* {*
* int i;*
* digitalWrite(13, true); // Flash a light to show received good message*
* // Message with a good checksum received, dump it.*
* Serial.print("Got: ");*

* for (i = 0; i < buflen; i++)*
* {*
_ Serial.print(buf*, HEX);
Serial.print(" ");
}
Serial.println("");
delay(200);
digitalWrite(13, false);
}
delay(4000);
}
void printId(DallasTemperature &sensor) {_

for (uint8_t i = 0; i < 8; i++) {
_ Serial.print(sensor.getSlaveAddr(), HEX);
}
}
[/quote]
> #include <VirtualWire.h>
> //Data received wire is on pin 11 by default*

>
> void setup()
> {
> Serial.begin(9600); // Debugging only
> Serial.println("setup");
> // Initialise the IO and ISR
> vw_set_ptt_inverted(true); // Required for DR3100
> vw_setup(2000); // Bits per sec
> vw_rx_start(); // Start the receiver PLL running
> }
> int line=1;
> char msg[20];
> unsigned char addr[8];
> int temp;
> int index;
> void loop()
> {
> uint8_t buf[VW_MAX_MESSAGE_LEN];
> uint8_t buflen = VW_MAX_MESSAGE_LEN;
> line=1;
> if (vw_get_message(buf, &buflen)) // Non-blocking
> {
> int i;
> digitalWrite(13, true); // Flash a light to show received good message
> // Message with a good checksum received, dump it.
> Serial.print("Got: ");
> switch(line){
> case 1 :

> for (i = 0; i < buflen; i++)
> { Serial.print(buf*, BYTE);
> msg=buf;}
> Serial.println();
> Serial.println(msg);
> line=2;
> break;
>
> case 2 :
> Serial.println((long int)buf);
> index=buf[1];
> Serial.println(index,BYTE);
> line=3;
> break;
>
> case 3:
> for (i = 0; i < buflen; i++)
> { Serial.print(buf, HEX);
> Serial.print(" ");
> addr=buf;}
> Serial.println();
> Serial.print(addr[8]);
> line=4;
> Serial.println();
> break;
>
> default :
> for (i = 0; i < buflen; i++)
> { Serial.print(buf, HEX);
> Serial.print(" ");
> temp=buf[2];}
> Serial.println();
> for (i = 0; i < buflen; i++)
> { Serial.print(temp, DEC);
> Serial.print(" ");
> line=1;
> break;
> }
> }
> line=1;
> digitalWrite(13,*_