Dependancies
Pre-requisites
🌳 An outdoor LoRa-GPS tracker with an E-Ink display 🔑
Transmit LoRa with an increasing integer counter to no destination address
Dependancies
Pre-requisites
#include <LoRa.h>
#include <SPI.h>
int counter = 0;
#define LEDPIN 2
#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 transmission...");
pinMode(LEDPIN, OUTPUT);
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() {
SerialUSB.print("Sending packet: ");
SerialUSB.println(counter);
LoRa.beginPacket();
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(2000);
digitalWrite(LEDPIN, HIGH);
delay(250);
digitalWrite(LEDPIN, LOW);
delay(250);
}
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