blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.85k stars 1.39k forks source link

ESP8266 - Sketch #2

Closed sticilface closed 9 years ago

sticilface commented 9 years ago

Can Blynk.begin(auth, "ssid", "pass"); be called without specifying the wifi credentials. If we are managing it elsewhere?

tzapu commented 9 years ago

if this is possible, it would be good to also have a non standalone example sketch, just to easily see how to add blynk as an addon to our existing esp projects

sticilface commented 9 years ago

you can easily add it to existing projects.

#include <BlynkSimpleEsp8266.h>

char auth[] = "xyz";

void setup() {

Blynk.begin(auth, "ssid", "pass");
}

void loop () {
Blynk.run();
}

// This takes the value of virtual pin 0 in blynk program...  if it is 1 turns on, else off...
BLYNK_WRITE(0)
{
  int a = param.asInt();
  if (a == 1) opState = RAINBOW; else opState = OFF;
}

//// This publishes the int power back to the blynk program...

BLYNK_READ(1)
{
  int power = getPixelPower();
  Blynk.virtualWrite(0, power);
}
tzapu commented 9 years ago

hi, i meant the same as you "Can Blynk.begin(auth, "ssid", "pass"); be called without specifying the wifi credentials. If we are managing it elsewhere? ".

i already have the wifi connection taken care of in another lib..

tzapu commented 9 years ago

another issue closely related to blynk managing the wifi connection is that if it fails to connect there s nothing i can do anymore, like reset the esp or try another access point, etc, it s just stuck there

vshymanskyy commented 9 years ago

I'm now working to enable connect/disconnect from Blynk server.. cheers :)

vshymanskyy commented 9 years ago

Guys, in the master branch I have implemented 3 features:

  1. Now you can call Blynk.disconnect() and Blynk.connect() to control connection to the server.
  2. Instead of calling Blynk.begin(...) you can call Blynk.config(auth) or Blynk.config(auth, server, port) this won't try to setup WiFi, Ethernet, etc. only token and server. there is also Blynk.connectWiFi(ssid, pass) - you can call it before Blynk.config(..) for ease of use.
  3. begin(..) and connectWiFi(..) will try to connect to Open network if pass is empty ("")

Please evaluate :)

tzapu commented 9 years ago

this works lovely, thank you very much

chinswain commented 7 years ago

Any plants to make these changes to BlynkSimpleShieldEsp8266 vshymanskyy?

vshymanskyy commented 7 years ago

@chinswain what's the problem?

pieman64 commented 7 years ago

@vshymanskyy please see this thread that explains the question from @chinswain http://community.blynk.cc/t/esp8266-as-a-shield-wifi-recovery/11666