Беспроводная связь arduino радиомодулями на 433МГц, Код из видео.

или беспроводные датчики температуры и влажности на ардуино

библиотеки

https://github.com/madsci1016/Arduino-EasyTransfer
http://www.airspayce.com/mikem/arduino/VirtualWire/

или https://www.dropbox.com/sh/9iesnz1telthmnn/AABTOjB24FEWioIPvunzZy40a?dl=0

 

// http://youtu.be/gPGOPkj9sSQ
//  код для передатчика
#include <VirtualWire.h>
#include <EasyTransferVirtualWire.h>
#include <dht11.h>

#define DHT11PIN 5

dht11 sensor;
EasyTransferVirtualWire ET; 

struct SEND_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to send
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  //Struct can'e be bigger then 26 bytes for VirtualWire version
  byte ID;
  int temperature;
  int humidity;
};

//give a name to the group of data
SEND_DATA_STRUCTURE mydata;

void setup(){
  //start the library, pass in the data details
  ET.begin(details(mydata));
  mydata.ID = 1;
  // Initialise the IO and ISR
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_set_tx_pin(8);
  vw_setup(2000);  // Bits per sec
  
  pinMode(13, OUTPUT);
  
  randomSeed(analogRead(0));
  
}

void loop(){
  
   sensor.read(DHT11PIN);
  //this is how you access the variables. [name of the group].[variable name]
  mydata.temperature = sensor.temperature;
  mydata.humidity = sensor.humidity;
  //send the data
  digitalWrite(13, HIGH);
  ET.sendData();
  digitalWrite(13, LOW); 
  
  delay(random(5000, 10000));
}

// http://youtu.be/gPGOPkj9sSQ
//  код для приемника
#include <VirtualWire.h>
#include <EasyTransferVirtualWire.h>
#include <LiquidCrystal.h>

//create object
EasyTransferVirtualWire ET; 
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

struct SEND_DATA_STRUCTURE{
  //put your variable definitions here for the data you want to send
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  //Struct can'e be bigger then 26 bytes for VirtualWire version
  byte ID;
  int temperature;
  int humidity;
};

//give a name to the group of data
SEND_DATA_STRUCTURE mydata;

void setup(){
  //start the library, pass in the data details
  ET.begin(details(mydata));
  Serial.begin(9600);
  // Initialise the IO and ISR
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);  // Bits per sec
  vw_set_rx_pin(11);
  vw_rx_start();       // Start the receiver PLL running
  
  lcd.begin(16, 2);
  lcd.clear();
  pinMode(13, OUTPUT);  
}

void loop(){
  //check and see if a data packet has come in. 
  if(ET.receiveData()){
    //this is how you access the variables. [name of the group].[variable name]
    //since we have data, we will blink it out. 
    if (mydata.ID == 1) {
      lcd.setCursor(0, 0);
      lcd.print("ID:");
      lcd.print(mydata.ID);
      lcd.setCursor(0, 2);
      lcd.print(mydata.temperature);
      lcd.print("C ");    
      lcd.print (mydata.humidity);
      lcd.print("% ");    
    }
    else if (mydata.ID == 2) {
      lcd.setCursor(8, 0);
      lcd.print("ID:");
      lcd.print(mydata.ID);
      lcd.setCursor(8, 2);
      lcd.print(mydata.temperature);
      lcd.print("C  ");    
      lcd.print (mydata.humidity);
      lcd.print("% ");    
    }
    
  } 
}