Advertisement
Guest User

ESP8266_Shield

a guest
Sep 14th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.20 KB | None | 0 0
  1. /*************************************************************
  2.   Download latest Blynk library here:
  3.     https://github.com/blynkkk/blynk-library/releases/latest
  4.  
  5.   Blynk is a platform with iOS and Android apps to control
  6.   Arduino, Raspberry Pi and the likes over the Internet.
  7.   You can easily build graphic interfaces for all your
  8.   projects by simply dragging and dropping widgets.
  9.  
  10.     Downloads, docs, tutorials: http://www.blynk.cc
  11.     Sketch generator:           http://examples.blynk.cc
  12.     Blynk community:            http://community.blynk.cc
  13.     Follow us:                  http://www.fb.com/blynkapp
  14.                                 http://twitter.com/blynk_app
  15.  
  16.   Blynk library is licensed under MIT license
  17.   This example code is in public domain.
  18.  
  19.  *************************************************************
  20.  
  21.   This example shows how to use ESP8266 Shield (with AT commands)
  22.   to connect your project to Blynk.
  23.  
  24.   WARNING!
  25.     It's very tricky to get it working. Please read this article:
  26.     http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware
  27.  
  28.   Change WiFi ssid, pass, and Blynk auth token to run :)
  29.   Feel free to apply it to any other example. It's simple!
  30.  *************************************************************/
  31.  
  32. /* Comment this out to disable prints and save space */
  33. #define BLYNK_PRINT Serial
  34.  
  35.  
  36. #include <ESP8266_Lib.h>
  37. #include <BlynkSimpleShieldEsp8266.h>
  38.  
  39. // You should get Auth Token in the Blynk App.
  40. // Go to the Project Settings (nut icon).
  41. char auth[] = "3c53485e468a4cbe929258afee88890c";
  42.  
  43. // Your WiFi credentials.
  44. // Set password to "" for open networks.
  45. char ssid[] = "SPEEEDUINO-PC";
  46. char pass[] = "SGEK6U7XYNSWR";
  47.  
  48. // Hardware Serial on Mega, Leonardo, Micro...
  49. //#define EspSerial Serial1
  50.  
  51. //or Software Serial on Uno, Nano...
  52. #include <SoftwareSerial.h>
  53. SoftwareSerial EspSerial(2, 4); // RX, TX
  54.  
  55. // Your ESP8266 baud rate:
  56. #define ESP8266_BAUD 9600
  57.  
  58. ESP8266 wifi(&EspSerial);
  59.  
  60. void setup()
  61. {
  62.   // Debug console
  63.   Serial.begin(9600);
  64.  
  65.   delay(10);
  66.  
  67.   // Set ESP8266 baud rate
  68.   EspSerial.begin(ESP8266_BAUD);
  69.   delay(10);
  70.  
  71.   Blynk.begin(auth, wifi, ssid, pass);
  72. }
  73.  
  74. void loop()
  75. {
  76.   Blynk.run();
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement