Wire.h and Radiohead rh_ask are not running simultaneously.

I am trying to run rf communication and i2c communication using wire library simultaneously on an arduino uno board. I am getting no errors while compiling but it doesn't work on the board. But both codes are working fine if run separately. Problem comes if I am combining both codes.

Problem comes if I am combining both codes.

The code you didn't post does something. You didn't say what it does.

You expect it to do something. You didn't say what you expect.

How can you reasonably expect us to help?

Sorry.. A transmitter transmits both rf and ultrasound as well as rf signal. I am using srf02 and 433 MHz transceivers. Basically transmitter provides the clock to the receiver. The transmitter code is given below:

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;
#include <stdlib.h>
#include <stdio.h>
#include <Wire.h>

void setup() {
//Serial.begin(9600);
Wire.begin();

}

void loop() {
const uint8_t *msg1 = "1";
const uint8_t *msg2 = "0";
driver.send((uint8_t *)msg1, 1);
driver.waitPacketSent();
driver.send((uint8_t *)msg2, 1);
driver.waitPacketSent();
Wire.beginTransmission(112); // transmit to device #112 (0x70)
//the address specified in the datasheet is 224 (0xE0)
//but i2c adressing uses the high 7 bits so it's 112
Wire.write(byte(0x00)); // sets register pointer to the command register (0x00)
Wire.write(byte(0x5C)); // command sensor to measure in "us" (0x5C)
// use 0x51 for centimeters
// use 0x52 for ping microseconds
Wire.endTransmission();
delay(100);

}

#include <stdlib.h>
#include <stdio.h>

Why?

Wire.beginTransmission(112); // transmit to device #112 (0x70)

Which is?

I'll repeat. The code does something. You need to tell is what it ACTUALLY does. You expect it to do something. You need to tell us what you expect it to do.

Have you tested the two devices independently?

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver;
#include <Wire.h>

void setup() {
//Serial.begin(9600);
Wire.begin();

}

void loop() {
const uint8_t *msg1 = "1";
const uint8_t *msg2 = "0";
 driver.send((uint8_t *)msg1, 1);
 driver.waitPacketSent();
 driver.send((uint8_t *)msg2, 1);
 driver.waitPacketSent();
Wire.beginTransmission(112); // transmit to device #112 (0x70)
 //the address specified in the datasheet is 224 (0xE0)
//but i2c adressing uses the high 7 bits so it's 112
Wire.write(byte(0x00)); // sets register pointer to the command register (0x00)
Wire.write(byte(0x5C)); // command sensor to measure in "us" (0x5C)
// use 0x51 for centimeters
// use 0x52 for ping microseconds
Wire.endTransmission(); 
delay(100); 

}

device 112 is an ultrasonic transmitter. I am trying to find the distance between two ultrasonic transmitters attached to two Different arduino boards. RF is used for clock synchronization between the boards.The above code is only the transmitter part

If you are not going to tell us what the code you posted ACTUALLY does, I'm going to stop reading your posts.

Hi PaulS,
I am using SRF02 ultrasonic sensors for ranging in fake mode. (transmitter and receiver on different boards. So I send an RF signal to alert the receiver to start measuring and then an ultrasonic signal. It did work with Virtual Wire library. But now the problem is to measure the ultrasonic signal using multiple receivers. The values are not correct when I use multiple receivers on an arduino board and reading serialy.
Thanks and Regards

So I send an RF signal to alert the receiver to start measuring

So, you think that packing the message to send, sending it, receiving it, and unpacking it takes no time? Have I got news for you.

The values are not correct when I use multiple receivers on an arduino board and reading serialy.

And the code that does that is where?

  (char*) buf==0;

Still don't understand the difference between = and ==, I see.

   Wire.beginTransmission(116); // transmit to device #112

That is NOT what that code does. If you are going to have useless comments, the useless comments MUST be accurate useless comments.

It really seems to me that you should send a request for data, read the reply, and then send another request to another device. Sending 4 requests for data, and then reading all the replies does not compute for me.

Use Tools + Auto Format before posting any more sloppy looking code.