first commit

This commit is contained in:
2021-05-11 20:43:42 +03:00
commit 9f3ffaba30
381 changed files with 69596 additions and 0 deletions

View File

@@ -0,0 +1,95 @@
/*******************************************************************************************************
Programs for Arduino - Copyright of the author Stuart Robinson - 23/02/20
This program is supplied as is, it is up to the user of the program to decide if the program is
suitable for the intended purpose and free from errors.
*******************************************************************************************************/
/*******************************************************************************************************
Program Operation - Transmits a FM tone using the LoRa device that can be picked up on an FM UHF
handheld receiver. The tones are not true FM but the UHF receiver does not know that.
Serial monitor baud rate is set at 9600
*******************************************************************************************************/
#define Program_Version "V1.0"
#include <SPI.h> //the lora device is SPI based so load the SPI library
#include <SX126XLT.h> //include the appropriate library
#include "Settings.h" //include the setiings file, frequencies, LoRa settings etc
SX126XLT LT; //create a library class instance called LT
void loop()
{
Serial.print(TXpower); //print the transmit power defined
Serial.print(F("dBm "));
Serial.println(F("PlayTone> "));
Serial.println();
digitalWrite(LED1, HIGH);
LT.toneFM(1000, 1000, deviation, adjustfreq, TXpower);
digitalWrite(LED1, LOW);
delay(1000);
}
void led_Flash(uint16_t flashes, uint16_t delaymS)
{
uint16_t index;
for (index = 1; index <= flashes; index++)
{
digitalWrite(LED1, HIGH);
delay(delaymS);
digitalWrite(LED1, LOW);
delay(delaymS);
}
}
void setup()
{
pinMode(LED1, OUTPUT); //setup pin as output for indicator LED
led_Flash(2, 125); //two quick LED flashes to indicate program start
pinMode(4, OUTPUT);
Serial.begin(9600);
Serial.println();
Serial.print(F(__TIME__));
Serial.print(F(" "));
Serial.println(F(__DATE__));
Serial.println(F(Program_Version));
Serial.println();
Serial.println(F("58_FM_Tone Starting"));
SPI.begin();
//SPI beginTranscation is normally part of library routines, but if it is disabled in library
//a single instance is needed here, so uncomment the program line below
//SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
//setup hardware pins used by device, then check if device is found
if (LT.begin(NSS, NRESET, RFBUSY, DIO1, SW, LORA_DEVICE))
{
Serial.println(F("LoRa Device found"));
led_Flash(2, 125); //two further quick LED flashes to indicate device found
delay(1000);
}
else
{
Serial.println(F("No device responding"));
while (1)
{
led_Flash(50, 50); //long fast speed LED flash indicates device error
}
}
LT.setupDirect(Frequency, Offset);
Serial.print(F("Tone Transmitter ready"));
Serial.println();
}

View File

@@ -0,0 +1,36 @@
/*******************************************************************************************************
Programs for Arduino - Copyright of the author Stuart Robinson - 23/02/20
This program is supplied as is, it is up to the user of the program to decide if the program is
suitable for the intended purpose and free from errors.
*******************************************************************************************************/
//******* Setup hardware pin definitions here ! ***************
//These are the pin definitions for one of my own boards, the Easy Pro Mini,
//be sure to change the definitions to match your own setup. Some pins such as DIO1,
//DIO2, BUZZER may not be in used by this sketch so they do not need to be
//connected and should be included and be set to -1.
#define NSS 10 //select pin on LoRa device
#define NRESET 9 //reset pin on LoRa device
#define LED1 8 //on board LED, high for on
#define RFBUSY 7 //SX126X busy pin
#define DIO1 3 //DIO1 pin on LoRa device, used for RX and TX done
#define DIO2 -1 //DIO2 pin on LoRa device, normally not used so set to -1
#define DIO3 -1 //DIO3 pin on LoRa device, normally not used so set to -1
#define SW -1 //SW pin on Dorji devices is used to turn RF switch on\off, set to -1 if not used
#define LORA_DEVICE DEVICE_SX1262 //we need to define the device we are using
//******* Setup Direct Modem Parameters Here ! ***************
const uint32_t Frequency = 434000000; //frequency of transmissions in hertz
const uint32_t Offset = 0; //offset frequency for calibration purposes
const uint16_t deviation = 10000; //deviation, total frequency shift low to high
const float adjustfreq = 0.9; //adjustment to tone frequency
const int8_t TXpower = 10; //LoRa transmit power in dBm