Advertisement
Azzar_budiyanto

config.h

Feb 26th, 2022
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.39 KB | None | 0 0
  1. //lib config
  2. #include <ESP8266WiFi.h>
  3. #include <ESP8266WiFiMulti.h>
  4. #include "Adafruit_MQTT.h"
  5. #include "Adafruit_MQTT_Client.h"
  6.  
  7. //pinout config out control
  8. int led1 = D0;
  9. int led2 = D1;
  10. int led3 = D2;
  11. int led4 = D3;
  12. int led5 = D6;
  13. int relay = D7;
  14.  
  15. //Defining the instance of ESP8266MultiWifi
  16. WiFiClient client;
  17. ESP8266WiFiMulti wifi_multi;
  18.  
  19. //wifi connectionn config
  20. //WiFi 1
  21. const char* ssid1 = "ora_bayar";
  22. const char* password1 = "password";
  23.  
  24. //WiFi 2
  25. const char* ssid2 = "android_ap";
  26. const char* password2 = "12345678";
  27.  
  28. //WiFi 3
  29. const char* ssid3 = "xiaomi";
  30. const char* password3 = "87654321";
  31.  
  32. //timeout config
  33. uint16_t connectTimeOutPerAP = 5000;
  34.  
  35. //millis timing
  36. const unsigned long eventInterval = 3000; //1000 for 1s
  37. unsigned long previousTime = 0;
  38.  
  39. //adafruit config
  40. #define AIO_SERVER      "io.adafruit.com"
  41. #define AIO_SERVERPORT  1883                   // use 8883 for SSL
  42. #define AIO_USERNAME    "your_aio_username"
  43. #define AIO_KEY         "your_aio_key"
  44.  
  45. //Set up the adafruit mqtt client
  46. Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
  47. //Set up the feed you're publishing to
  48. Adafruit_MQTT_Publish AgricultureData = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/sensor.soil");
  49. //Set up the feed you're subscribing to
  50. Adafruit_MQTT_Subscribe Pump = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/relay4");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement