[Micropython][TPYBoard v701]Arduino TPLoRa v1.0 接收数据
原创版权归山东萝卜科技有限公司所有,转载必须以链接形式注明作者和原始出处。
接收程序
#include <SPI.h> #include <LoRa.h> void setup() { Serial.begin(9600); while (!Serial); pinMode(LED_BUILTIN,OUTPUT); Serial.println("LoRa Receiver"); Serial.println(LoRa.begin(433E6)); if (!LoRa.begin(433E6)) { Serial.println("Starting LoRa failed!"); while (1); } Serial.println("begin:"); } void loop() { // try to parse packet int packetSize = LoRa.parsePacket(); // Serial.println(packetSize); if (packetSize) { // received a packet Serial.println("Received packet '"); // read packet while (LoRa.available()) { Serial.print((char)LoRa.read()); } // print RSSI of packet Serial.print("' with RSSI "); Serial.println(LoRa.packetRssi()); digitalWrite(LED_BUILTIN,HIGH); delay(100); digitalWrite(LED_BUILTIN,LOW); delay(100); } }