Skip to main content
deleted 117 characters in body; edited title
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

How do I get sensor values using transmitter and recieverreceiver?

I used an HC-SR04 sensor and connected it to an Arduino board (BOARD1) with a 433 MHz transmitter, and the other board (BOARD2) is connected to the 433 MHz receiver but. I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

    #include <RH_ASK.h>
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    int echo=11;
    int trig=9; int sensorval;
    void setup()
    {
    
        Serial.begin(9600);   // Debugging only
    
       driver.init();
    
    }
    
    void loop()
    {
        digitalWrite(trig,LOW);
       delayMicroseconds(10);
       digitalWrite(trig,HIGH);
       delayMicroseconds(10);
       digitalWrite(trig,LOW);
       delayMicroseconds(10);
       sensorval=pulseIn(echo,HIGH);
         const char *msg = sensorval;
    
        driver.send((uint8_t *)msg, strlen(msg));
        driver.waitPacketSent();
        delay(200);
    }

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
 
RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup() {
   Serial.begin(9600); // Debugging only
   driver.init();
}

void loop() {
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
   const char *msg = sensorval;
   driver.send((uint8_t *)msg, strlen(msg));
   driver.waitPacketSent();
   delay(200);
}
    #include <RH_ASK.h>
    
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    const int sensorval;
    void setup()
    {
        Serial.begin(9600);   // Debugging only
        driver.init();
    
    }
    
    void loop()
    {
        uint8_t buf[4];
        uint8_t buflen = sizeof(buf);
    
        if (driver.recv(buf, &buflen)) // Non-blocking
        {
        Serial.print("message Received: ");
     Serial.println((char*)buf);
        }
    }
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;
const int sensorval;
void setup() {
    Serial.begin(9600); // Debugging only
    driver.init();
}

void loop() {
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}

How do I get sensor values using transmitter and reciever

I used an HC-SR04 sensor and connected it to an Arduino board (BOARD1) with a 433 MHz transmitter and the other board (BOARD2) is connected to the 433 MHz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

    #include <RH_ASK.h>
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    int echo=11;
    int trig=9; int sensorval;
    void setup()
    {
    
        Serial.begin(9600);   // Debugging only
    
       driver.init();
    
    }
    
    void loop()
    {
        digitalWrite(trig,LOW);
       delayMicroseconds(10);
       digitalWrite(trig,HIGH);
       delayMicroseconds(10);
       digitalWrite(trig,LOW);
       delayMicroseconds(10);
       sensorval=pulseIn(echo,HIGH);
         const char *msg = sensorval;
    
        driver.send((uint8_t *)msg, strlen(msg));
        driver.waitPacketSent();
        delay(200);
    }

    #include <RH_ASK.h>
    
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    const int sensorval;
    void setup()
    {
        Serial.begin(9600);   // Debugging only
        driver.init();
    
    }
    
    void loop()
    {
        uint8_t buf[4];
        uint8_t buflen = sizeof(buf);
    
        if (driver.recv(buf, &buflen)) // Non-blocking
        {
        Serial.print("message Received: ");
     Serial.println((char*)buf);
        }
    }

How do I get sensor values using transmitter and receiver?

I used an HC-SR04 sensor and connected it to an Arduino board (BOARD1) with a 433 MHz transmitter, and the other board (BOARD2) is connected to the 433 MHz receiver. I don't know how to see the sensor value readings from the (BOARD1) in the serial monitor.

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
 
RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup() {
   Serial.begin(9600); // Debugging only
   driver.init();
}

void loop() {
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
   const char *msg = sensorval;
   driver.send((uint8_t *)msg, strlen(msg));
   driver.waitPacketSent();
   delay(200);
}
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;
const int sensorval;
void setup() {
    Serial.begin(9600); // Debugging only
    driver.init();
}

void loop() {
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}
Bumped by Community user

I used an HC-SR04 sensor and connected it to an arduinoArduino board (BOARD1) with a 433 mhzMHz transmitter and the other board (BOARD2) is connected to the 433 mhzMHz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

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


RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup()
{

    Serial.begin(9600);   // Debugging only

   driver.init();

}

void loop()
{
    digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
     const char *msg = sensorval;

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}
    #include <RH_ASK.h>
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    int echo=11;
    int trig=9; int sensorval;
    void setup()
    {
    
        Serial.begin(9600);   // Debugging only
    
       driver.init();
    
    }
    
    void loop()
    {
        digitalWrite(trig,LOW);
       delayMicroseconds(10);
       digitalWrite(trig,HIGH);
       delayMicroseconds(10);
       digitalWrite(trig,LOW);
       delayMicroseconds(10);
       sensorval=pulseIn(echo,HIGH);
         const char *msg = sensorval;
    
        driver.send((uint8_t *)msg, strlen(msg));
        driver.waitPacketSent();
        delay(200);
    }

#include <RH_ASK.h>

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


RH_ASK driver;
const int sensorval;
void setup()
{
    Serial.begin(9600);   // Debugging only
    driver.init();

}

void loop()
{
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}
    #include <RH_ASK.h>
    
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    const int sensorval;
    void setup()
    {
        Serial.begin(9600);   // Debugging only
        driver.init();
    
    }
    
    void loop()
    {
        uint8_t buf[4];
        uint8_t buflen = sizeof(buf);
    
        if (driver.recv(buf, &buflen)) // Non-blocking
        {
        Serial.print("message Received: ");
     Serial.println((char*)buf);
        }
    }

I used an HC-SR04 sensor and connected it to an arduino board (BOARD1) with a 433 mhz transmitter and the other board (BOARD2) is connected to the 433 mhz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

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


RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup()
{

    Serial.begin(9600);   // Debugging only

   driver.init();

}

void loop()
{
    digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
     const char *msg = sensorval;

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}
#include <RH_ASK.h>

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


RH_ASK driver;
const int sensorval;
void setup()
{
    Serial.begin(9600);   // Debugging only
    driver.init();

}

void loop()
{
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}

I used an HC-SR04 sensor and connected it to an Arduino board (BOARD1) with a 433 MHz transmitter and the other board (BOARD2) is connected to the 433 MHz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

    #include <RH_ASK.h>
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    int echo=11;
    int trig=9; int sensorval;
    void setup()
    {
    
        Serial.begin(9600);   // Debugging only
    
       driver.init();
    
    }
    
    void loop()
    {
        digitalWrite(trig,LOW);
       delayMicroseconds(10);
       digitalWrite(trig,HIGH);
       delayMicroseconds(10);
       digitalWrite(trig,LOW);
       delayMicroseconds(10);
       sensorval=pulseIn(echo,HIGH);
         const char *msg = sensorval;
    
        driver.send((uint8_t *)msg, strlen(msg));
        driver.waitPacketSent();
        delay(200);
    }

    #include <RH_ASK.h>
    
    #include <SPI.h> // Not actually used but needed to compile
    
    
    RH_ASK driver;
    const int sensorval;
    void setup()
    {
        Serial.begin(9600);   // Debugging only
        driver.init();
    
    }
    
    void loop()
    {
        uint8_t buf[4];
        uint8_t buflen = sizeof(buf);
    
        if (driver.recv(buf, &buflen)) // Non-blocking
        {
        Serial.print("message Received: ");
     Serial.println((char*)buf);
        }
    }
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 213 characters in body
Source Link
chrisl
  • 16.6k
  • 2
  • 18
  • 27

I used an HC-SR04 sensor and connected it to an arduino board (BOARD1) with a 433 mhz transmitter and the other board (BOARD2) is connected to the 433 mhz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

HERE IS THE CODE OF THE TRANSMITTER

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


RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup()
{

    Serial.begin(9600);   // Debugging only

   driver.init();

}

void loop()
{
    digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
     const char *msg = sensorval;

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}```


**HERE IS THE CODE OF THE RECEIVER**
```#include

HERE IS THE CODE OF THE RECEIVER

#include <RH_ASK.h>

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


RH_ASK driver;
const int sensorval;
void setup()
{
    Serial.begin(9600);   // Debugging only
    driver.init();

}

void loop()
{
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}```

I used an HC-SR04 sensor and connected it to an arduino board (BOARD1) with a 433 mhz transmitter and the other board (BOARD2) is connected to the 433 mhz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

HERE IS THE CODE OF THE TRANSMITTER

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


RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup()
{

    Serial.begin(9600);   // Debugging only

   driver.init();

}

void loop()
{
    digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
     const char *msg = sensorval;

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}```


**HERE IS THE CODE OF THE RECEIVER**
```#include <RH_ASK.h>

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


RH_ASK driver;
const int sensorval;
void setup()
{
    Serial.begin(9600);   // Debugging only
    driver.init();

}

void loop()
{
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}```

I used an HC-SR04 sensor and connected it to an arduino board (BOARD1) with a 433 mhz transmitter and the other board (BOARD2) is connected to the 433 mhz receiver but I don't know how to see the sensor value readings from the (BOARD1) and seen in the serial monitor.

HERE IS THE CODE OF THE TRANSMITTER

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


RH_ASK driver;
int echo=11;
int trig=9; int sensorval;
void setup()
{

    Serial.begin(9600);   // Debugging only

   driver.init();

}

void loop()
{
    digitalWrite(trig,LOW);
   delayMicroseconds(10);
   digitalWrite(trig,HIGH);
   delayMicroseconds(10);
   digitalWrite(trig,LOW);
   delayMicroseconds(10);
   sensorval=pulseIn(echo,HIGH);
     const char *msg = sensorval;

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}

HERE IS THE CODE OF THE RECEIVER

#include <RH_ASK.h>

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


RH_ASK driver;
const int sensorval;
void setup()
{
    Serial.begin(9600);   // Debugging only
    driver.init();

}

void loop()
{
    uint8_t buf[4];
    uint8_t buflen = sizeof(buf);

    if (driver.recv(buf, &buflen)) // Non-blocking
    {
    Serial.print("message Received: ");
 Serial.println((char*)buf);
    }
}
Source Link
Loading