Created
April 20, 2018 02:19
-
-
Save sabas1080/b65299bac722df0ab57f01cc3bf6a3d7 to your computer and use it in GitHub Desktop.
Example for RAK811 with Lora Sender and library LoRa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example for RAK811 with Lora Sender and library LoRa https://github.com/sandeepmistry/arduino-LoRa | |
*/ | |
#include <SPI.h> | |
#include <LoRa.h> | |
int counter = 0; | |
void setup() { | |
Serial.begin(9600); | |
while (!Serial); | |
SPI.setMISO(RADIO_MISO_PORT); | |
SPI.setMOSI(RADIO_MOSI_PORT); | |
SPI.setSCLK(RADIO_SCLK_PORT); | |
SPI.setSSEL(RADIO_NSS_PORT); | |
LoRa.setPins(RADIO_NSS_PORT, RADIO_RESET_PORT, RADIO_DIO_0_PORT); | |
Serial.println("LoRa Sender"); | |
if (!LoRa.begin(915E6)) { | |
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++; | |
delay(5000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment