Giter Club home page Giter Club logo

Comments (6)

sabas1080 avatar sabas1080 commented on May 27, 2024

Hi @geologic

Can you show us your code?

from beelan-lorawan.

geologic avatar geologic commented on May 27, 2024

Sure.
It is pretty much the same code of the example:

#include <lorawan.h>


//ABP Credentials 
const char *devAddr = "26015D3F";
const char *nwkSKey = "F67BB976CE405DC19F3FC0C4C6AB4CC9";
const char *appSKey = "CCF9DE27B57151410DC78AEF0B3FB089";

const unsigned long interval = 30000;    // 30 s interval to send message
unsigned long previousMillis = 0;  // will store last time message sent
unsigned int counter = 0;     // message counter

char myStr[50];
char outStr[255];
byte recvStatus = 0;

#define DEBUG_LED 7                   // D7 - led 
#define EN_LORA 2                     // D2 - enable LDO @ 3V3
const sRFM_pins RFM_pins = {
  .CS = 10,                           // RST - D9; CS - D10; MOSI - D11; MISO - D12; SCK - D13; DIO0 - D3; DIO1 - D4; DIO2 - D5; DIO5 - D6;
  .RST = 9,                           
  .DIO0 = 3,
  .DIO1 = 4,
  .DIO2 = 5,
  .DIO5 = 6,
};

void setup() {
  // Setup loraid access
  Serial.begin(57600);
  while(!Serial);

  pinMode(EN_LORA,OUTPUT);
  digitalWrite(EN_LORA,HIGH);

    pinMode(DEBUG_LED,OUTPUT);
    digitalWrite(DEBUG_LED,LOW);
  
  if(!lora.init()){
    Serial.println("LoRa module not found!");
    while (1) {}    
  } else {
    Serial.println("LoRa module found."); 
  }

  // Set LoRaWAN Class change CLASS_A or CLASS_C
  lora.setDeviceClass(CLASS_A);

  // Set Data Rate
  //lora.setDataRate(SF9BW125);
  lora.setDataRate(SF7BW125);

  // set channel to random
  lora.setChannel(MULTI);
  
  // Put ABP Key and DevAddress here
  lora.setNwkSKey(nwkSKey);
  lora.setAppSKey(appSKey);
  lora.setDevAddr(devAddr);
}
  
void loop() {
  // Check interval overflow
  if(millis() - previousMillis > interval) {
    digitalWrite(DEBUG_LED,HIGH);
    previousMillis = millis(); 

    sprintf(myStr, "Counter-%d", counter); 

    Serial.print("Sending: ");
    Serial.println(myStr);
    
    lora.sendUplink(myStr, strlen(myStr), 0, 1);
    counter++;
     digitalWrite(DEBUG_LED,LOW);
  }

  recvStatus = lora.readData(outStr);
  if(recvStatus) {
    Serial.println(outStr);
  }
  
  // Check Lora RX
  lora.update();
}

from beelan-lorawan.

mr3188 avatar mr3188 commented on May 27, 2024

Hi @geologic
Which branch and region are you using?

from beelan-lorawan.

geologic avatar geologic commented on May 27, 2024

I'm using the master branch and region EU-868

from beelan-lorawan.

mr3188 avatar mr3188 commented on May 27, 2024

I tried the same code and everything seems to work fine. The only part of your code I can't test is all related to EN_LORA pin.

It sends and un link every 30 seconds incrementing the count as expected.

from beelan-lorawan.

wero1414 avatar wero1414 commented on May 27, 2024

Closing cause not activity

from beelan-lorawan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.