File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- Basic ESP8266 MQTT example
2+ Basic ESP8266 / ESP32 MQTT example
33 This sketch demonstrates the capabilities of the pubsub library in combination
44 with the ESP8266 board/library.
55 It connects to an MQTT server then:
2222#include < ESP8266WiFi.h>
2323#elif defined(ESP32)
2424#include < WiFi.h>
25+ #include < esp_random.h>
2526#define BUILTIN_LED A0
27+ #define RANDOM_REG32 esp_random ()
2628#else
2729#error Platform not supported.
2830#endif
@@ -56,7 +58,7 @@ void setup_wifi() {
5658 Serial.print (" ." );
5759 }
5860
59- randomSeed (micros () );
61+ randomSeed (RANDOM_REG32 );
6062
6163 Serial.println (" " );
6264 Serial.println (" WiFi connected" );
Original file line number Diff line number Diff line change 11/*
2- Long message ESP8266 MQTT example
2+ Long message ESP8266 / ESP32 MQTT example
33
44 This sketch demonstrates sending arbitrarily large messages in combination
55 with the ESP8266 board/library.
2727#include < ESP8266WiFi.h>
2828#elif defined(ESP32)
2929#include < WiFi.h>
30+ #include < esp_random.h>
3031#define BUILTIN_LED A0
32+ #define RANDOM_REG32 esp_random ()
3133#else
3234#error Platform not supported.
3335#endif
@@ -59,7 +61,7 @@ void setup_wifi() {
5961 Serial.print (" ." );
6062 }
6163
62- randomSeed (micros () );
64+ randomSeed (RANDOM_REG32 );
6365
6466 Serial.println (" " );
6567 Serial.println (" WiFi connected" );
You can’t perform that action at this time.
0 commit comments