Files
GateOpener/Yeller/main.cpp
T
2026-10-22 14:41:48 -05:00

47 lines
922 B
C++

#include <pico/stdlib.h>
#include <hardware/spi.h>
#include <FreeRTOSConfig.h>
#include <FreeRTOS.h>
#include <Module.h>
#include <PicoHal.h>
int main() {
PicoHal* pico = new PicoHal(
spi0,
PICO_LORA_MISO,
PICO_LORA_MOSI,
PICO_LORA_SCK
);
// Currently written as numbered 1-40th pin on Pico
SX1262 radio = new Module(
pico,
PICO_LORA_SPI_CS,
PICO_LORA_SPI_DIO1,
PICO_LORA_RST,
PICO_LORA_BUSY
);
ConfigLoRa_t config;
config.frequency = 915;
int state = radio.begin(config);
if (state == RADIOLIB_ERR_NONE){
printf("LoRa module initialized\n");
while(true) {
state = radio.startTransmit("Howdiddly doo");
if (state == RADIOLIB_ERR_NONE) {
printf("Transmitted properly!\n");
} else {
printf("Transmission failed\n");
}
sleep_ms(2000);
}
} else {
printf("Could not initialize LoRa module\n");
while(true) {
printf("Fuuuuuck\n");
sleep_ms(2000);
}
}
}