Çözüldü2.50K görüntülenmeLoraarduino-nano Lora
0

Merhabalar, sistemimizde bulunan

mpu6050

bmp280

gy-neo6mv2 sensörlerinden aldığımız verileri sizden satın aldığımız LoRa modülleri aracılığıyla başka port ekranına yazdırmak istiyoruz.

serial.println kullandığımızda aldığımız çıkışlar bunlardır -> https://prnt.sc/0Db61OjSmYNc

bu çıkışları LoRa kullanarak başka ekrana yazdırmak istiyoruz.

  1. Kod örnek kütüphaneden aldığımız ve sizin videonuzdan gördüğümüz LoRa mesaj gönderme kodlarıdır.
  2. Kod ise bizim mpu6050 bmp280 ve gyneomv2 sensörlerinin kodları

örnek kütühane kodları 2km ye kadar çalışabilmektedir (ötesinin testi yapılmadı)

diğer yaptığımız sistemdeki sensör verileride kendi çapında çalışmaktadır.

yapmamız gereken tek şey bu iki kodu birleştirebilmek ama bunu beceremiyoruz.

yardımınıza ihtiyacımız var

-> .ino dosyaları zipte yer almaktadır (https://www.dosya.tc/server36/sc9mp1/a.zip.html)

Şimdiden teşekkürler.

#include "Arduino.h"<br />#include "LoRa_E32.h"<br /> #include <SoftwareSerial.h><br />SoftwareSerial mySerial(10, 11); // Arduino RX <-- e32 TX, Arduino TX --> e32 RX<br />LoRa_E32 e32ttl(&mySerial);<br />   void printParameters(struct Configuration configuration);<br />void printModuleInformation(struct ModuleInformation moduleInformation);<br /> void setup()<br />{<br /> Serial.begin(9600);<br /> while (!Serial) {<br />     ; // <br />    }<br /> delay(100);<br />  e32ttl.begin();<br /> }<br />struct Message {<br />    char type[5];<br />    char message[8];<br />    int temperature;<br />} message;<br /> int i = 0;<br /> void loop()<br />{<br /> delay(2500);<br /> i++;<br /> struct Message {<br />     char type[5] = "TEMP";<br />     char message[8] = "Kitchen";<br />     byte temperature[4];<br /> } message;<br />  *(float*)(message.temperature) = 19.2;<br />  ResponseStatus rs = e32ttl.sendFixedMessage(0,2,6,&message, sizeof(Message));<br /> Serial.println(rs.getResponseDescription());<br />}<br /> void printParameters(struct Configuration configuration) {<br /> Serial.println("----------------------------------------");<br />  Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);<br /> Serial.println(F(" "));<br /> Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, BIN);<br /> Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, BIN);<br /> Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());<br /> Serial.println(F(" "));<br /> Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());<br /> Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());<br /> Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());<br />  Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());<br /> Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());<br /> Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());<br /> Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());<br /> Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());<br />  Serial.println("----------------------------------------");<br /> }<br />void printModuleInformation(struct ModuleInformation moduleInformation) {<br /> Serial.println("----------------------------------------");<br /> Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);<br />  Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);<br /> Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);<br /> Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);<br /> Serial.println("----------------------------------------");<br /> }

#include <Wire.h><br />#include <SPI.h><br />#include <Adafruit_BMP280.h><br />#include <MPU6050_tockn.h><br />#include <TinyGPSPlus.h><br />#include <SoftwareSerial.h><br />#include <SoftwareSerial.h><br /> #define BMP_SCK  (13)<br />#define BMP_MISO (12)<br />#define BMP_MOSI (11)<br />#define BMP_CS   (10)<br /> static const int RXPin = 4, TXPin = 3;<br />static const uint32_t GPSBaud = 9600;   <br />TinyGPSPlus gps;<br />SoftwareSerial ss(RXPin, TXPin);<br />    Adafruit_BMP280 bmp; <br />MPU6050 mpu6050(Wire);<br /> void printParameters(struct Configuration configuration);<br />void printModuleInformation(struct ModuleInformation moduleInformation);<br /> void setup() <br />{<br />  while (!Serial) {<br />    ;<br />  }<br />  Serial.begin(9600);<br />  ss.begin(GPSBaud);<br />     Wire.begin();<br />  mpu6050.begin();<br />  mpu6050.calcGyroOffsets(true);<br />  while ( !Serial ) delay(100);   <br />  Serial.println(F("FERGANI ROKET TAKIMI©"));<br />  unsigned status;<br />     status = bmp.begin();<br />  if (!status) {<br />    Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "<br />                      "try a different address!"));<br />    Serial.print("SensorID was: 0x"); Serial.println(bmp.sensorID(),16);<br />    Serial.print("        ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");<br />    Serial.print("   ID of 0x56-0x58 represents a BMP 280,\n");<br />    Serial.print("        ID of 0x60 represents a BME 280.\n");<br />    Serial.print("        ID of 0x61 represents a BME 680.\n");<br />    while (1) delay(10);<br />  }<br />   /* Default settings from datasheet. */<br />  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */<br />                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */<br />                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */<br />                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */<br />                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */<br />}<br /> static void printFloat(float val, bool valid, int len, int prec)<br />{<br />  if (!valid)<br />  {<br />    while (len-- > 1)<br />      Serial.print('*');<br />    Serial.print(' ');<br />  }<br />  else<br />  {<br />    Serial.print(val, prec);<br />    int vi = abs((int)val);<br />    int flen = prec + (val < 0.0 ? 2 : 1); // . and -<br />    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;<br />    for (int i=flen; i<len; ++i)<br />      Serial.print(' ');<br />  }<br />  smartDelay(0);<br />}<br />  static void smartDelay(unsigned long ms)<br />{<br />  unsigned long start = millis();<br />  do <br />  {<br />    while (ss.available())<br />      gps.encode(ss.read());<br />  } while (millis() - start < ms);<br />}<br />  static void printInt(unsigned long val, bool valid, int len)<br />{<br />  char sz[32] = "*****************";<br />  if (valid)<br />    sprintf(sz, "%ld", val);<br />  sz[len] = 0;<br />  for (int i=strlen(sz); i<len; ++i)<br />    sz[i] = ' ';<br />  if (len > 0) <br />    sz[len-1] = ' ';<br />  Serial.print(sz);<br />  smartDelay(0);<br />}<br /> static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)<br />{<br />  if (!d.isValid())<br />  {<br />    Serial.print(F("********** "));<br />  }<br />  else<br />  {<br />    char sz[32];<br />    sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());<br />    Serial.print(sz);<br />  }<br />     if (!t.isValid())<br />  {<br />    Serial.print(F("******** "));<br />  }<br />  else<br />  {<br />    char sz[32];<br />    sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());<br />    Serial.print(sz);<br />  }<br />   printInt(d.age(), d.isValid(), 5);<br />  smartDelay(0);<br />}<br /> static void printStr(const char *str, int len)<br />{<br />  int slen = strlen(str);<br />  for (int i=0; i<len; ++i)<br />    Serial.print(i<slen ? str[i] : ' ');<br />  smartDelay(0);<br />}<br />  void loop() {<br />    mpu6050.update();<br />     Serial.println("=======================================================");<br />    Serial.println("BMP280 VERILERI");<br />    Serial.print(F("Temperature = "));<br />    Serial.print(bmp.readTemperature());<br />    Serial.println(" *C");<br />     Serial.print(F("Pressure = "));<br />    Serial.print(bmp.readPressure());<br />    Serial.println(" Pa");<br />     Serial.print(F("Approx altitude = "));<br />    Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */<br />    Serial.println(" m");<br />     Serial.println();<br />    Serial.println("=======================================================");<br />    Serial.println("MPU6050 VERILERI");<br />    Serial.print("temp : ");Serial.println(mpu6050.getTemp());<br />    Serial.print("accX : ");Serial.print(mpu6050.getAccX());<br />    Serial.print("\taccY : ");Serial.print(mpu6050.getAccY());<br />    Serial.print("\taccZ : ");Serial.println(mpu6050.getAccZ());<br />       Serial.print("gyroX : ");Serial.print(mpu6050.getGyroX());<br />    Serial.print("\tgyroY : ");Serial.print(mpu6050.getGyroY());<br />    Serial.print("\tgyroZ : ");Serial.println(mpu6050.getGyroZ());<br />       Serial.print("accAngleX : ");Serial.print(mpu6050.getAccAngleX());<br />    Serial.print("\taccAngleY : ");Serial.println(mpu6050.getAccAngleY());<br />       Serial.print("gyroAngleX : ");Serial.print(mpu6050.getGyroAngleX());<br />    Serial.print("\tgyroAngleY : ");Serial.print(mpu6050.getGyroAngleY());<br />    Serial.print("\tgyroAngleZ : ");Serial.println(mpu6050.getGyroAngleZ());<br />         Serial.print("angleX : ");Serial.print(mpu6050.getAngleX());<br />    Serial.print("\tangleY : ");Serial.print(mpu6050.getAngleY());<br />    Serial.print("\tangleZ : ");Serial.println(mpu6050.getAngleZ());<br />    Serial.println("=======================================================\n");<br />    Serial.println("GY-NEO6MV2 GPS ENLEM BOYLAM BİLGİLERİ\n");<br />  printInt(gps.satellites.value(), gps.satellites.isValid(), 5);<br />  printFloat(gps.hdop.hdop(), gps.hdop.isValid(), 6, 1);<br />  printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);<br />  printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);<br />  printInt(gps.location.age(), gps.location.isValid(), 5);<br />  printDateTime(gps.date, gps.time);<br />  printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);<br />  printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);<br />  printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);<br />  printStr(gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.deg()) : "*** ", 6);<br />  Serial.println("=======================================================\n");<br />      delay(2000);<br />}

Soru yeni cevaplara kapalıdır.
Mehmet En iyi cevap olarak seçildi Mayıs 11, 2022