You've already forked arduino-LoRa
							
							
				mirror of
				https://github.com/sandeepmistry/arduino-LoRa.git
				synced 2025-10-30 22:05:40 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			590 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			590 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <SPI.h>
 | |
| #include <LoRa.h>
 | |
| 
 | |
| void setup() {
 | |
|   Serial.begin(9600);
 | |
|   while (!Serial);
 | |
| 
 | |
|   Serial.println("LoRa Receiver");
 | |
| 
 | |
|   if (!LoRa.begin(915E6)) {
 | |
|     Serial.println("Starting LoRa failed!");
 | |
|     while (1);
 | |
|   }
 | |
| }
 | |
| 
 | |
| void loop() {
 | |
|   // try to parse packet
 | |
|   int packetSize = LoRa.parsePacket();
 | |
|   if (packetSize) {
 | |
|     // received a packet
 | |
|     Serial.print("Received packet '");
 | |
| 
 | |
|     // read packet
 | |
|     while (LoRa.available()) {
 | |
|       Serial.print((char)LoRa.read());
 | |
|     }
 | |
| 
 | |
|     // print RSSI of packet
 | |
|     Serial.print("' with RSSI ");
 | |
|     Serial.println(LoRa.packetRssi());
 | |
|   }
 | |
| }
 |