Dependancies
Pre-requisites
🌳 An outdoor LoRa-GPS tracker with an E-Ink display 🔑
Receive LoRa with an increasing integer counter
Dependancies
Pre-requisites
ls -al /dev/cu.usbmodem
and arduino-cli board list
. Run make
to compile and upload the code to the board.
#include <LoRa.h>
#include <SPI.h>
#define RADIO_CS_PIN 5 // D5 on Arduino Zero
#define RADIO_DI0_PIN 11 // D11 on Arduino Zero
#define RADIO_RST_PIN 6 // D6 on Arduino Zero
#define LORA_FREQUENCY 915E6 // 915 MHz Antenna and LoRa module
void setup() {
SerialUSB.begin(9600);
SerialUSB.println("Starting LoRa Receiver...");
LoRa.setPins(RADIO_CS_PIN, RADIO_RST_PIN, RADIO_DI0_PIN);
if (!LoRa.begin(LORA_FREQUENCY)) {
SerialUSB.println("Starting LoRa failed!");
while (1) {
}
}
}
void loop() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
SerialUSB.print("Received packet '");
while (LoRa.available()) {
SerialUSB.print((char)LoRa.read());
}
SerialUSB.print("' with RSSI ");
SerialUSB.println(LoRa.packetRssi());
}
}
BOARD?=hutscape:samd:oak
PORT := $(shell ls /dev/cu.usbmodem*)
BUILD=build
.PHONY: default lint all flash clean
default: lint all flash clean
lint:
cpplint --extensions=ino --filter=-legal/copyright,-whitespace/line_length,-readability/casting,-readability/todo *.ino
all:
arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./
flash:
arduino-cli upload -p $(PORT) --fqbn $(BOARD) --input-dir $(BUILD) --verbose
clean:
rm -r build