Code to transmit DHT11 over RF from arduino to arduino

I got my arduinos to communicate with each other by simple blink led code. Im using 433Mhz RF sender/receiver for it

Since Im new to this coding on arduino, I have no clue how to make DHT11 sensor (temperature/huminity) to send its data to receiving arduino.

Im keeping the receiving arduino connected via USB to laptop, so I can read what temperature are over internet.

Can anyone help me with code to send the DHT11 data over RF to receiving arduino and to show it on terminal?

Im using 433Mhz RF sender/receiver for it

Which ones? Connected to which pins?

Can anyone help me with code to send the DHT11 data over RF

Not without a LOT more information.

Wardemon:
I got my arduinos to communicate with each other by simple blink led code.
Im using 433Mhz RF sender/receiver for it

Welcome to the Forum. Please post the code that you already have. Read the two posts at the top of this Forum by Nick Gammon on guidelines for posting here, especially the use of code tags ("</>") when posting source code files. Also, before posting the code, use Ctrl-T in the IDE to reformat the code in a standard format, which makes it easier for us to read.

Also please tell us which RF units you have, and which library you are using to support them.

the RF senders are those ASK ones

Receiver code

// Remote Receiving Temparature and Humidity over RF Link to LCD Display
// how to use VirtualWire to receive messages and display floating point values to SerialMonitor
// rx pin 3 on mega

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
  Serial.begin(9600);  // Debugging only

  // Initialise the IO and ISR
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);  // Bits per sec
  vw_set_rx_pin(3);
  vw_rx_start();       // Start the receiver PLL running
}

void loop()
{

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  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.

    for (i = 0; i < buflen; i++)
    {
      Serial.print(buf[i]);  // the received data is stored in buffer
    }
    Serial.println("");
  }
}

Transmitter code

// Remote transmitting Temparature and Humidity over RF Link to SerialMonitor
// DHT11 Sensor

#include  <VirtualWire.h>// library for RF RX/TX
#undef int
#undef abs
#undef double
#undef float
#undef round
#undef round

#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT11   // DHT 11 
DHT dht(DHTPIN, DHTTYPE);

float temp_c;
float humidity;
int packet = 0;
char charnum[10];

void setup()
{
  //  Debug Serial.begin(38400);
  // Serial.println("Starting up");

  // Initialise the IO and ISR
  vw_set_tx_pin(3);
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);   // Bits per sec
  dht.begin();
}

void loop()
{
  byte error;
  byte rh;
  float humival_f;
  float tempval_f;
  float dew_point_f;

  char str[15];

  // Read values from the sensor
  float temp_c;
  float humidity;
  temp_c = dht.readTemperature();
  humidity = dht.readHumidity();

  char buff[30];
  sprintf(buff, "%c", 255);
  const char *msg0 = buff;
  vw_send((uint8_t *)msg0, strlen(msg0)); // Send control character
  vw_wait_tx(); // Wait until the whole message is gone

  // Serial.print("Temperature = ");
  serialPrintFloat(temp_c);
  sprintf(buff, "%cC ", 223);
  const char *msg1 = buff;
  vw_send((uint8_t *)msg1, strlen(msg1));
  vw_wait_tx(); // Wait until the whole message is gone
  // Serial.print("C");

  ////////////////////////////////////////////////////////////////////////////////////////
  sprintf(buff, "%c", 254);
  const char *msg5 = buff;
  vw_send((uint8_t *)msg5, strlen(msg5));
  vw_wait_tx(); // Wait until the whole message is gone

  // Serial.print(" Rel Humidity = ");
  serialPrintFloat(humidity);
  // Serial.print("%");
  const char *msg2 = "% ";
  vw_send((uint8_t *)msg2, strlen(msg2));
  vw_wait_tx(); // Wait until the whole message is gone

  delay(1000);
}

void serialPrintFloat( float f) {
  //Serial.print((int)f);
  itoa((int)f, charnum, 10);
  vw_send((uint8_t *)charnum, strlen(charnum));
  vw_wait_tx(); // Wait until the whole message is gone
  // Serial.print(".");
  const char *msg = ".";
  vw_send((uint8_t *)msg, strlen(msg));
  vw_wait_tx(); // Wait until the whole message is gone

  int temp = (f - (int)f) * 100;
  // Serial.print( abs(temp) );
  itoa(abs(temp), charnum, 10);
  vw_send((uint8_t *)charnum, strlen(charnum));
  vw_wait_tx(); // Wait until the whole message is gone
}

I get strange gibberish on mega receiver end on terminal.
Im trying to measure only celcius and humidity.

Id like to get info as following in terminaldigit, Example: Celsius: 26, Humidity: 50% <-percent mark not needed but I want info as percent

Libraries are virtualwire and DHT-sensor-library-master(from adafruit)

Gibberish from terminal

255
5052
48
254
48
3732
255
5052
46
2236732
48
3732
5052
46
48
254

Your 'gibberish' corresponds quite well to what you sent.

0xFF, "020", 0xFE, "0% ", 0xFF, "02.", 0xDF, "$ 0% 24.0", 0xFE

255
 - 0xFF
5052
 - '0' '2'
48
 - '0'
254
 - 0xFE
48
 - '0'
3732
 - '%' ' '
255
 - 0xFF
5052
 - '0' '2'
46
 - '.'
2236732
 - 0xDF '

Sending one char..

  sprintf(buff, "%c", 255);
  const char *msg0 = buff;
  vw_send((uint8_t *)msg0, strlen(msg0)); // Send control character

// could be

  msg0 = 255;
  vw_send((uint8_t *)msg0, 1); // Send control character

// or

 vw_send((uint8_t *)"\xFF", 1); // Send control character

' ' 48 - '0' 3732 - '%' ' ' 5052 - '2' '4' 46 - '.' 48 - '0' 254 - 0xFE ```

Sending one char..

§_DISCOURSE_HOISTED_CODE_1_§

How about using something like:

void sendFloat(float f)
{
byte sLen = strlen(itoa((int)(f*1000), charnum, 10));  // 1 digit more for the '.' 

  charnum[sLen-1] = charnum[sLen-2];
  charnum[sLen-2] = charnum[sLen-3]; 
  charnum[sLen-3] = '.';
  vw_send((uint8_t *)charnum, sLen);
  vw_wait_tx();
}

Note: The 223 you are sending is probably a relict from an lcd-output, the 223 denotes a '°' there (If I remember correctly).