LoRaSender.ino 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. Basic test program, send date at the BAND you seted.
  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. int counter = 0;
  12. void setup() {
  13. //WIFI Kit series V1 not support Vext control
  14. Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
  15. }
  16. void loop() {
  17. Serial.print("Sending packet: ");
  18. Serial.println(counter);
  19. // send packet
  20. LoRa.beginPacket();
  21. LoRa.print("hello ");
  22. LoRa.print(counter);
  23. LoRa.endPacket();
  24. counter++;
  25. digitalWrite(25, HIGH); // turn the LED on (HIGH is the voltage level)
  26. delay(1000); // wait for a second
  27. digitalWrite(25, LOW); // turn the LED off by making the voltage LOW
  28. delay(1000); // wait for a second
  29. }