在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Inteform/esp32-lora-library开源软件地址(OpenSource Url):https://github.com/Inteform/esp32-lora-library开源编程语言(OpenSource Language):C 98.3%开源软件介绍(OpenSource Introduction):esp32-lora-libraryWhat is itesp32-lora-library is a C component to be integrated into ESP32-IDF for sending and receiving data through a LoRa transceiver based on Semtech's SX127_ ICs. The library itself is based on sandeepmistry's arduino-LoRa (https://github.com/sandeepmistry/arduino-LoRa) library for Arduino. How to installSimply clone the repository and copy the git clone https://github.com/Inteform/esp32-lora-library
cp -r esp32-lora-library/components /path/to/my/esp32/project
cd /path/to/my/esp32/project
make menuconfig
make
#etc Basic usageA simple sender program... #include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "lora.h"
void task_tx(void *p)
{
for(;;) {
vTaskDelay(pdMS_TO_TICKS(5000));
lora_send_packet((uint8_t*)"Hello", 5);
printf("packet sent...\n");
}
}
void app_main()
{
lora_init();
lora_set_frequency(915e6);
lora_enable_crc();
xTaskCreate(&task_tx, "task_tx", 2048, NULL, 5, NULL);
}
Meanwhile in the receiver program... #include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "lora.h"
uint8_t but[32];
void task_rx(void *p)
{
int x;
for(;;) {
lora_receive(); // put into receive mode
while(lora_received()) {
x = lora_receive_packet(buf, sizeof(buf));
buf[x] = 0;
printf("Received: %s\n", buf);
lora_receive();
}
vTaskDelay(1);
}
}
void app_main()
{
lora_init();
lora_set_frequency(915e6);
lora_enable_crc();
xTaskCreate(&task_rx, "task_rx", 2048, NULL, 5, NULL);
} Connection with the RF moduleBy default, the pins used to control the RF transceiver are--
but you can reconfigure the pins using |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论