Wiring :
Import Library LoRa
• Open Arduino IDE dan bukaSketch > Include Library > Manage Libraries dan cari LoRa by Sandeep Mistry version 0.3.0 dan klikinstall
Transceiver
#include <SPI.h>
#include <LoRa.h>
//define the pins used by the transceiver module
#define ss5
#define rst14
#define dio0 2
intcounter = 0;
void setup() {Serial.begin(115200);
while (!Serial);
Serial.println("LoRaSender");
//setup LoRatransceiver module
LoRa.setPins(ss, rst, dio0);
while (!LoRa.begin(433E6)) {
Serial.println(".");
delay(500); }
// Change sync word (0xF3) to match the receiver
// The sync word assures you don't get LoRamessages from other LoRatransceivers
// ranges from 0-0xFF
LoRa.setSyncWord(0xF3);
Serial.println("LoRaInitializing OK!");
}
void loop() {
Serial.print("Sending packet: ");
erial.println(counter);
//Send LoRapacket to receiver
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(10000);
}
Tidak ada komentar:
Posting Komentar