Created
September 10, 2019 11:42
-
-
Save jenschr/5690465b6a1df6d982fe7c673016c9b7 to your computer and use it in GitHub Desktop.
Very simple LoRa client for TTGO 1.0 boards
This file contains 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
#include <SPI.h> | |
#include <LoRa.h> | |
int counter = 0; | |
#define SCK 5 // GPIO5 -- SX1278's SCK | |
#define MISO 19 // GPIO19 -- SX1278's MISO | |
#define MOSI 27 // GPIO27 -- SX1278's MOSI | |
#define SS 18 // GPIO18 -- SX1278's CS | |
#define RST 14 // GPIO14 -- SX1278's RESET | |
#define DI0 26 // GPIO26 -- SX1278's IRQ(Interrupt Request) | |
void setup() { | |
Serial.begin(9600); | |
while (!Serial); | |
Serial.println("LoRa Sender"); | |
SPI.begin(SCK, MISO, MOSI, SS); | |
LoRa.setPins(SS, RST, DI0); | |
if (!LoRa.begin(866E6)) { | |
Serial.println("Starting LoRa failed!"); | |
while (1); | |
} | |
} | |
void loop() { | |
Serial.print("Sending packet: "); | |
Serial.println(counter); | |
// send packet | |
LoRa.beginPacket(); | |
LoRa.print("helloiz "); | |
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