LoRaReceiver.ino 970 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. Check the new incoming messages, and print via serialin 115200 baud rate.
  3. by Aaron.Lee from HelTec AutoMation, ChengDu, China
  4. 成都惠利特自动化科技有限公司
  5. www.heltec.cn
  6. this project also realess in GitHub:
  7. https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
  8. */
  9. #include "heltec.h"
  10. #define BAND 433E6 //you can set band here directly,e.g. 868E6,915E6
  11. void setup() {
  12. //WIFI Kit series V1 not support Vext control
  13. Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
  14. }
  15. void loop() {
  16. // try to parse packet
  17. int packetSize = LoRa.parsePacket();
  18. if (packetSize) {
  19. // received a packet
  20. Serial.print("Received packet '");
  21. // read packet
  22. while (LoRa.available()) {
  23. Serial.print((char)LoRa.read());
  24. }
  25. // print RSSI of packet
  26. Serial.print("' with RSSI ");
  27. Serial.println(LoRa.packetRssi());
  28. }
  29. }