Libraries and Citations - leesm5/Wireless-Bluetooth-Security-System GitHub Wiki

Libraries

RH_ASK

RadioHead: RH_ASK was used to send a signal from the transmission arduino and to monitor and recieve the signal on the receiving arduino.

http://www.airspayce.com/mikem/arduino/RadioHead/classRH__ASK.html

Download Link: http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.41.zip

Citations

Transmission Code and Circuit Diagram

This code was used to handle the transmission of the message. In my program it was modified to send a one character message. It is from https://randomnerdtutorials.com/rf-433mhz-transmitter-receiver-module-with-arduino/

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

RH_ASK driver;

void setup()
{
    Serial.begin(9600);   // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    const char *msg = "Hello World!";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(1000);
}

Receiver Code and Circuit Diagram

Below is the code from https://randomnerdtutorials.com/rf-433mhz-transmitter-receiver-module-with-arduino/ for Receiver. This code was adapted for my program and is the basis of receiving and reading a message.

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

RH_ASK driver;

void setup()
{
    Serial.begin(9600); // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    uint8_t buf[12];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      int i;
      // Message with a good checksum received, dump it.
      Serial.print("Message: ");
      Serial.println((char*)buf);         
    }
}

Timer

Logic for the timer was adapted from this example. Millis continues to count up and this shows how to use algebra to reset it when wanted. https://learn.adafruit.com/multi-tasking-the-arduino-part-1/using-millis-for-timing

⚠️ **GitHub.com Fallback** ⚠️