sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.63k stars 625 forks source link

transmits a single package and stop #204

Open alemori opened 5 years ago

alemori commented 5 years ago

Hello, I'm using an arduino one connected to a sx1278 of 433mhz, when I run the shipping sketch runs the first package and then does not send any more, what can be?

morganrallen commented 5 years ago

What is "the shipping sketch"? If you mean the sketch the device shipped with, maybe that's all it does? Try working with one of the examples provided.

alemori commented 5 years ago

I am using your sketch provided by you

wero1414 commented 5 years ago

Please provide your code and your wiring to the SX1278

alemori commented 5 years ago

The connection is :

SX1278 | Wemos D1 MINI Gnd | Gnd 3.3 | 3.3 Dio00 | GPIO5 Dio01 | GPIO4 MISO | GPIO12 MOSI | GPIO13 SS | GPIO15 RST | GPIO16 SCK | GPIO14

include

include

int counter = 0;

void setup() { Serial.begin(9600); while (!Serial);

Serial.println("LoRa Sender");

if (!LoRa.begin(433E6)) { Serial.println("Starting LoRa failed!"); while (1); } }

void loop() { Serial.print("Sending packet: "); Serial.println(counter);

// send packet LoRa.beginPacket(); LoRa.print("hello "); LoRa.print(counter); LoRa.endPacket();

counter++;

morganrallen commented 5 years ago

Two things stand out right away. 1) you're not using the default pins you are not calling setPins This has me surprised you are receiving any packets at all

2) though your example cuts off so I cannot be sure, if you don't have a delay in your loop you'll be sending the packet over and over again as fast as the processor can handle, this will prevent the radio from actually ever transmitting.

I think it's more likely the first issue, you need to call setPins

alemori commented 5 years ago

Sorry, the scketch has setpins(15,5,4) with the corresponding pins according to the connection you send, there is also the delay. I copied the sketch badly.

alemori commented 5 years ago

Make another test with arduino one, and go the code

include

include

int counter = 0;

void setup() { Serial.begin(9600); LoRa.setPins(10, 9, 2); while (!Serial);

Serial.println("LoRa Sender");

if (!LoRa.begin(433E6)) { Serial.println("Starting LoRa failed!"); while (1); } pinMode(5,OUTPUT); }

void loop() { Serial.print("Sending packet: "); Serial.println(counter); digitalWrite(5,LOW); // send packet LoRa.beginPacket(); LoRa.print("hello "); LoRa.print(counter); LoRa.endPacket(); digitalWrite(5,HIGH); int rssi = LoRa.packetRssi(); counter++;

delay(5000); }