VERİCİ<br />#include "LoRa_E22.h"<br />#include <SoftwareSerial.h><br />SoftwareSerial mySerial(10, 11); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX<br />LoRa_E22 e22ttl(&mySerial);<br /> #define M0 7<br />#define M1 6<br />#define LED 5<br /> const float OffSet = 0.483 ;<br />float sensorValue = 0;<br />float V;<br />struct Signal {<br /> char type[15];<br /> byte Nem[4];<br />} data;<br /> void setup() {<br /> pinMode(M0, OUTPUT);<br /> pinMode(M1, OUTPUT);<br /> digitalWrite(M0, LOW);<br /> digitalWrite(M1, LOW);<br /> Serial.begin(9600);<br /> e22ttl.begin();<br /> pinMode(LED, OUTPUT);<br /> delay(500);<br />}<br /> void loop() {<br /> digitalWrite(LED, HIGH);<br /> V = analogRead(A1) * 5.00 / 1024;<br /> sensorValue= (V - OffSet) * 2.5;<br /> Serial.println("Yer: Haşim Kuyu");<br /> Serial.print("Bar Değeri = ");<br /> Serial.println(sensorValue);<br /> //Gönderilecek paket veri hazırlanıyor<br /> struct Signal {<br /> char type[15] = "Haşim Kuyu";<br /> byte Nem[4];<br /> } data2;<br /> *(float*)(data2.Nem) = sensorValue ;<br /> ResponseStatus rs = e22ttl.sendFixedMessage(0, 22, 23, &data2, sizeof(Signal));<br /> Serial.println(rs.getResponseDescription());<br /> delay(1000);<br /> }<br />------------------------------------------------------------------------<br />ALICI<br />#include <WiFi.h><br />#include "ThingSpeak.h"<br />#include <HardwareSerial.h><br />#include "LoRa_E22.h"<br /> const char* ssid = "TurkTelekom_TPE5A4_2.4GHz"; // your network SSID (name)<br />const char* password = "336699ch"; // your network password<br /> WiFiClient client;<br />unsigned long myChannelNumber = 1847319;<br />const char * myWriteAPIKey = "Z0NJ6TO27B1SA1VV";<br /> #define M0 32 //3in1 PCB mizde pin 7<br />#define M1 33 //3in1 PCB mizde pin 6<br />#define RX 27 //3in1 PCB mizde pin RX<br />#define TX 35 //3in1 PCB mizde pin TX<br /> HardwareSerial fixajSerial(1); <br />LoRa_E22 e22(TX, RX, &fixajSerial, UART_BPS_RATE_9600);<br /> struct Signal {<br /> char type[15] ;<br /> byte Nem[4];<br />} data;<br /> void setup() {<br /> pinMode(M0, OUTPUT);<br /> pinMode(M1, OUTPUT);<br /> digitalWrite(M0, LOW);<br /> digitalWrite(M1, LOW);<br /> Serial.begin(115200);<br /> delay(500);<br /> e22.begin();<br /> delay(500);<br /> char* source = "Fixaj.com";<br /> strcpy(data.type, source);<br /> ResponseStatus rs = e22.sendFixedMessage(0, 21, 23, &data, sizeof(Signal));<br /> Serial.println(rs.getResponseDescription());<br /> WiFi.mode(WIFI_STA);<br /> ThingSpeak.begin(client);<br />}<br /> void loop() {<br /> if (WiFi.status() != WL_CONNECTED) {<br /> Serial.print("Attempting to connect");<br /> while (WiFi.status() != WL_CONNECTED) {<br /> WiFi.begin(ssid, password);<br /> delay(5000);<br /> }<br /> Serial.println("\nConnected.");<br /> }<br /> while (e22.available() > 1) {<br /> ResponseStructContainer rsc =e22.receiveMessage(sizeof(Signal));<br /> struct Signal data = *(Signal*) rsc.data;<br /> Serial.print("Yer: ");<br /> Serial.println(data.type);<br /> Serial.print("Bar Değeri: ");<br /> Serial.println(*(float*)(data.Nem));<br /> rsc.close();<br /> bar = (*(float*)(data.Nem)) ;<br /> }<br /> int x = ThingSpeak.writeField(myChannelNumber, 1, bar, myWriteAPIKey);<br /> }
VERİCİ PARAMETRE(21,23)
ALICI PARAMETRE(22,23)
E22 ler nano-nano olarak denendi hiçbir problem yok. ESP32(alıcı) kodlarının loraya uygunluğunu kontrol ederseniz sevinirim. Teşekkürler.
Sipariş Numarası;202235823215
Sipariş Numarası;209476155216
VERİCİ < br / >
#include “LoRa_E22.h”<br />
#include <SoftwareSerial.h><br />
SoftwareSerial mySerial(10, 11); // Arduino RX <– e22 TX, Arduino TX –> e22 RX<br /
LoRa_E22 e22ttl(&mySerial); < br / >
#define M0 7<br />
#define M1 6<br />
#define LED 5<br />
const float OffSet = 0.483 ; < br / >
float sensorValue = 0; < br / >
float V; < br / >
struct Signal {
< br / >
char type[15]; < br / >
byte Nem[4]; < br / >
} data; < br / >
void setup() {
< br / >
pinMode(M0, OUTPUT); < br / >
pinMode(M1, OUTPUT); < br / >
digitalWrite(M0, LOW); < br / >
digitalWrite(M1, LOW); < br / >
Serial.begin(9600); < br / >
e22ttl.begin(); < br / >
pinMode(LED, OUTPUT); < br / >
delay(500); < br / >
} < br / >
void loop() {
< br / >
digitalWrite(LED, HIGH); < br / >
V = analogRead(A1) * 5.00 / 1024; < br / >
sensorValue = (V – OffSet) * 2.5; < br / >
Serial.println(“Yer: Haşim Kuyu”); < br / >
Serial.print(“Bar Değeri = “); < br / >
Serial.println(sensorValue); < br / >
//Gönderilecek paket veri hazırlanıyor<br />
struct Signal {
< br / >
char type[15] = “Haşim Kuyu”; < br / >
byte Nem[4]; < br / >
}
data2; < br / >
*(float*)(data2.Nem) = sensorValue ; < br / >
ResponseStatus rs = e22ttl.sendFixedMessage(0, 22, 23, &data2, sizeof(Signal)); < br / >
Serial.println(rs.getResponseDescription()); < br / >
delay(1000); < br / >
} < br / > ———————————————————————— < br / >
ALICI < br / >
#include <WiFi.h><br />
#include “ThingSpeak.h”<br /
> #include <HardwareSerial.h><br /
> #include “LoRa_E22.h”<br />
const char* ssid = “TurkTelekom_TPE5A4_2.4GHz”; // your network SSID (name)<br /
> const char* password = “336699ch”; // your network password<br />
WiFiClient client; < br / >
unsigned long myChannelNumber = 1847319; < br / >
const char * myWriteAPIKey = “Z0NJ6TO27B1SA1VV”; < br / >
#define M0 32 //3in1 PCB mizde pin 7<br /
> #define M1 33 //3in1 PCB mizde pin 6<br />
#define RX 27 //3in1 PCB mizde pin RX<br />
#define TX 35 //3in1 PCB mizde pin TX<br />
HardwareSerial fixajSerial(1); < br / >
LoRa_E22 e22(TX, RX, &fixajSerial, UART_BPS_RATE_9600); < br / >
struct Signal {
< br / >
char type[15] ; < br / >
byte Nem[4]; < br / >
} data; < br / >
void setup() {
< br / >
pinMode(M0, OUTPUT); < br / >
pinMode(M1, OUTPUT); < br / >
digitalWrite(M0, LOW); < br / >
digitalWrite(M1, LOW); < br / >
Serial.begin(115200); < br / >
delay(500); < br / >
e22.begin(); < br / >
delay(500); < br / >
char* source = “Fixaj.com”; < br / >
strcpy(data.type, source); < br / >
ResponseStatus rs = e22.sendFixedMessage(0, 21, 23, &data, sizeof(Signal)); < br / >
Serial.println(rs.getResponseDescription()); < br / >
WiFi.mode(WIFI_STA); < br / >
ThingSpeak.begin(client); < br / >
} < br / >
void loop() {
< br / >
if (WiFi.status() != WL_CONNECTED) {
< br / >
Serial.print(“Attempting to connect”); < br / >
while (WiFi.status() != WL_CONNECTED) {
< br / >
WiFi.begin(ssid, password); < br / >
delay(5000); < br / >
} < br / >
Serial.println(“\nConnected.”); < br / >
} < br / >
while (e22.available() > 1) {
< br / >
ResponseStructContainer rsc = e22.receiveMessage(sizeof(Signal)); < br / >
struct Signal data = *(Signal*) rsc.data; < br / >
Serial.print(“Yer: “); < br / >
Serial.println(data.type); < br / >
Serial.print(“Bar Değeri: “); < br / >
Serial.println(*(float*)(data.Nem)); < br / >
rsc.close(); < br / >
bar = (*(float*)(data.Nem)) ; < br / >
} < br / >
int x = ThingSpeak.writeField(myChannelNumber, 1, bar, myWriteAPIKey); < br / >
}