derFelix244

Untitled

Apr 13th, 2026
83
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. /* Heltec Automation Ping Pong communication test example
  2. *
  3. * Function:
  4. * 1. Ping Pong communication in two esp32 device.
  5. *
  6. * Description:
  7. * 1. Only hardware layer communicate, no LoRaWAN protocol support;
  8. * 2. Download the same code into two esp32 devices, then they will begin Ping Pong test each other;
  9. * 3. This example is for esp32 hardware basic test.
  10. *
  11. * HelTec AutoMation, Chengdu, China
  12. * 成都惠利特自动化科技有限公司
  13. * www.heltec.org
  14. *
  15. * this project also realess in GitHub:
  16. * https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
  17. * */
  18.  
  19. #include "LoRaWan_APP.h"
  20. #include "Arduino.h"
  21.  
  22.  
  23.  
  24. #define RF_FREQUENCY 868000000 // Hz
  25.  
  26. #define TX_OUTPUT_POWER 5 // dBm
  27.  
  28. #define LORA_BANDWIDTH 0 // [0: 125 kHz,
  29. // 1: 250 kHz,
  30. // 2: 500 kHz,
  31. // 3: Reserved]
  32. #define LORA_SPREADING_FACTOR 7 // [SF7..SF12]
  33. #define LORA_CODINGRATE 1 // [1: 4/5,
  34. // 2: 4/6,
  35. // 3: 4/7,
  36. // 4: 4/8]
  37. #define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
  38. #define LORA_SYMBOL_TIMEOUT 0 // Symbols
  39. #define LORA_FIX_LENGTH_PAYLOAD_ON false
  40. #define LORA_IQ_INVERSION_ON false
  41.  
  42.  
  43. #define RX_TIMEOUT_VALUE 1000
  44. #define BUFFER_SIZE 30 // Define the payload size here
  45.  
  46. char txpacket[BUFFER_SIZE];
  47. char rxpacket[BUFFER_SIZE];
  48.  
  49. static RadioEvents_t RadioEvents;
  50. void OnTxDone( void );
  51. void OnTxTimeout( void );
  52. void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
  53.  
  54. typedef enum
  55. {
  56. LOWPOWER,
  57. STATE_RX,
  58. STATE_TX
  59. }States_t;
  60.  
  61. int16_t txNumber;
  62. States_t state;
  63. bool sleepMode = false;
  64. int16_t Rssi,rxSize;
  65.  
  66.  
  67. void setup() {
  68. Serial.begin(115200);
  69. Mcu.begin(HELTEC_BOARD,SLOW_CLK_TPYE);
  70. txNumber=0;
  71. Rssi=0;
  72.  
  73. RadioEvents.TxDone = OnTxDone;
  74. RadioEvents.TxTimeout = OnTxTimeout;
  75. RadioEvents.RxDone = OnRxDone;
  76.  
  77. Radio.Init( &RadioEvents );
  78. Radio.SetChannel( RF_FREQUENCY );
  79. Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
  80. LORA_SPREADING_FACTOR, LORA_CODINGRATE,
  81. LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
  82. true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );
  83.  
  84. Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
  85. LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
  86. LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
  87. 0, true, 0, 0, LORA_IQ_INVERSION_ON, true );
  88. state=STATE_TX;
  89. }
  90.  
  91.  
  92.  
  93. void loop()
  94. {
  95. switch(state)
  96. {
  97. case STATE_TX:
  98. delay(1000);
  99. txNumber++;
  100. sprintf(txpacket,"hello %d, Rssi : %d",txNumber,Rssi);
  101. Serial.printf("\r\nsending packet \"%s\" , length %d\r\n",txpacket, strlen(txpacket));
  102. Radio.Send( (uint8_t *)txpacket, strlen(txpacket) );
  103. state=LOWPOWER;
  104. break;
  105. case STATE_RX:
  106. Serial.println("into RX mode");
  107. Radio.Rx( 0 );
  108. state=LOWPOWER;
  109. break;
  110. case LOWPOWER:
  111. Radio.IrqProcess( );
  112. break;
  113. default:
  114. break;
  115. }
  116. }
  117.  
  118. void OnTxDone( void )
  119. {
  120. Serial.print("TX done......");
  121. state=STATE_RX;
  122. }
  123.  
  124. void OnTxTimeout( void )
  125. {
  126. Radio.Sleep( );
  127. Serial.print("TX Timeout......");
  128. state=STATE_TX;
  129. }
  130.  
  131. void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
  132. {
  133. Rssi=rssi;
  134. rxSize=size;
  135. memcpy(rxpacket, payload, size );
  136. rxpacket[size]='\0';
  137. Radio.Sleep( );
  138.  
  139. Serial.printf("\r\nreceived packet \"%s\" with Rssi %d , length %d\r\n",rxpacket,Rssi,rxSize);
  140. Serial.println("wait to send next packet");
  141.  
  142. state=STATE_TX;
  143. }
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Nyxdimyu
    10 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment