Çözüldü140 görüntülenmeLoraproje rssi
0

#include "Arduino.h"<br />#include "LoRa_E22.h"<br />#define DESTINATION_ADDL 3<br />#include <HardwareSerial.h><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 e22ttl(TX, RX, &fixajSerial, UART_BPS_RATE_9600);<br /> void printParameters(struct Configuration configuration);<br />  void setup() {<br />  Serial.begin(9600);<br />  delay(500);<br />    // Startup all pins and UART<br />  e22ttl.begin();<br />      ResponseStructContainer c;<br />    c = e22ttl.getConfiguration();<br />    // It's important get configuration pointer before all other operation<br />    Configuration configuration = *(Configuration*) c.data;<br />    Serial.println(c.status.getResponseDescription());<br />    Serial.println(c.status.code);<br />      printParameters(configuration);<br />    c.close();<br />      Serial.println("Hi, I'm going to send message!");<br />    // Send message<br />  ResponseStatus rs = e22ttl.sendFixedMessage(0, DESTINATION_ADDL, 23, "Hello, world?");<br />  // Check If there is some problem of succesfully send<br />  Serial.println(rs.getResponseDescription());<br />}<br />  void loop() {<br />    // If something available<br />  if (e22ttl.available()>1) {<br />      // read the String message<br />    ResponseContainer rc = e22ttl.receiveMessageRSSI();<br />    // Is something goes wrong print error<br />    if (rc.status.code!=1){<br />        Serial.println(rc.status.getResponseDescription());<br />    }else{<br />        // Print the data received<br />        Serial.println(rc.status.getResponseDescription());<br />        Serial.println(rc.data);<br />        Serial.print("RSSI: "); Serial.println(rc.rssi, DEC);<br />    }<br />  }<br />  if (Serial.available()) {<br />      String input = Serial.readString();<br />      e22ttl.sendFixedMessage(0, DESTINATION_ADDL, 23, input);<br />  }<br />}<br />  void printParameters(struct Configuration configuration) {<br />    Serial.println("----------------------------------------");<br />      Serial.print(F("HEAD : "));  Serial.print(configuration.COMMAND, HEX);Serial.print(" ");Serial.print(configuration.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(configuration.LENGHT, HEX);<br />    Serial.println(F(" "));<br />    Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, HEX);<br />    Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, HEX);<br />    Serial.print(F("NetID : "));  Serial.println(configuration.NETID, HEX);<br />    Serial.println(F(" "));<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.getUARTBaudRateDescription());<br />    Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRateDescription());<br />    Serial.println(F(" "));<br />    Serial.print(F("OptionSubPacketSett: "));  Serial.print(configuration.OPTION.subPacketSetting, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getSubPacketSetting());<br />    Serial.print(F("OptionTranPower    : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());<br />    Serial.print(F("OptionRSSIAmbientNo: "));  Serial.print(configuration.OPTION.RSSIAmbientNoise, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getRSSIAmbientNoiseEnable());<br />    Serial.println(F(" "));<br />    Serial.print(F("TransModeWORPeriod : "));  Serial.print(configuration.TRANSMISSION_MODE.WORPeriod, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());<br />    Serial.print(F("TransModeTransContr: "));  Serial.print(configuration.TRANSMISSION_MODE.WORTransceiverControl, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORTransceiverControlDescription());<br />    Serial.print(F("TransModeEnableLBT : "));  Serial.print(configuration.TRANSMISSION_MODE.enableLBT, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());<br />    Serial.print(F("TransModeEnableRSSI: "));  Serial.print(configuration.TRANSMISSION_MODE.enableRSSI, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());<br />    Serial.print(F("TransModeEnabRepeat: "));  Serial.print(configuration.TRANSMISSION_MODE.enableRepeater, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRepeaterModeEnableByteDescription());<br />    Serial.print(F("TransModeFixedTrans: "));  Serial.print(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());<br />        Serial.println("----------------------------------------");<br />}

Soru yeni cevaplara kapalıdır.
Mehmet En iyi cevap olarak seçildi Eylül 6, 2022
0

parametreler de aşağıdaki gibi siteye bağlı kalınarak düzenlenmiştir.

Mehmet En iyi cevap olarak seçildi Eylül 6, 2022
1 cevaptan 1'ini inceliyorsun, tüm cevapları görmek için buraya tıklayın.
Whatsapp'tan Yaz
1
Ürün Danışmanı Burada!
fixaj.com Ürün Danışmanı
Merhaba,

Ben sadece "Satın Alma" konularında destek vermekteyim.

Kodlama yardımı, haberleşme hataları, bağlantı şemaları vb. konularla ilgili "Soru&Cevap" https://fixaj.com/sorucevap/ sayfamızı ziyaret edebilirsiniz.