//modified lora library by Sandeep Mistry for TTGO ESP32 Lora // lora Sender modified by HwThinker #include #include #define SCK 5 // GPIO5 -- lora SCK #define MISO 19 // GPIO19 -- lora MISO #define MOSI 27 // GPIO27 -- lora MOSI #define SS 18 // GPIO18 -- lora CS #define RST 23 // GPIO23 -- RESET #define DI0 26 // GPIO26 -- IRQ(Interrupt Request) //#define BAND 915E6 // 915MHz sesuaikan dengan Frekuensi Lora anda #define BAND 433E6 // 433MHz Sesuaikan dengan Frekuensi Lora anda int counter = 0; void setup() { Serial.begin(9600); //pastikan terminal serial emulator baudrate 9600 No parity 1 stop Bit while (!Serial); //If just the the basic function, must connect to a computer SPI.begin(SCK, MISO, MOSI, SS); LoRa.setPins(SS, RST, DI0); // Serial.println("LoRa Sender"); if (!LoRa.begin(BAND)) { Serial.println("Starting LoRa failed!"); while (1); } Serial.println("LoRa Initial OK!"); } void loop() { Serial.print("Sending packet: "); Serial.println(counter); // send packet LoRa.beginPacket(); LoRa.print("hello "); LoRa.print(counter); LoRa.endPacket(); counter++; delay(3000); }