What did you figure out? I am having the same issue, when I run the script on this page on a NodeMCU 1.0 (ESP-12E) it runs great and connects to the local server immediately, when I run the exact same script on the Adafruit Huzzah ESP8266 it will not connect to the local server (Raspberry Pi Zero (W). I am running v0.5.2, and my server is v0.36.2
Hey @bgresens
I don’t even remember if I actually found the specific issue. Here is my code that ended up working.
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG // Optional, this enables more detailed prints
#include <Blynk.h>
#include <ESP8266WiFi.h> // for ESP8266
#include <BlynkSimpleEsp8266.h> // for ESP8266
#include <Wire.h>
#include <SimpleTimer.h>
char auth[] = "[REDACTED]";
char ssid[] = "[REDACTED]";
char pass[] = "[REDACTED]";
char server[] = "192.168.1.104";
int port = 8080;
SimpleTimer timer;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Blynk.config(auth, server, port);
Blynk.connect();
pinMode( 0, OUTPUT);
digitalWrite(12, LOW); //GPIO13
pinMode(12, OUTPUT); // Pin connected to the Relay
}
BLYNK_WRITE(V7) {
if (param.asInt())
{
digitalWrite(12, LOW); // turn relay ON
timer.setTimeout(500, openOff); // run this program after 500mS
}
}
void openOff() {
digitalWrite(12, HIGH); // turn relay OFF
Blynk.virtualWrite(V7, 0); // set virtual pin 7 LOW
}
void loop() {
Blynk.run();
}
I was using the same hardware as you, and the latest software at the time.
Thanks @TeddJohnson, unfortunately it has the same results. @Gunner, may I ask if you have any thoughts? I turned on the Debug port, but realized I am not sure how to read the output; but the only difference I see is “aid 1” vs “aid 2”.
Here is the output from the 2 different modules running your sample code from above:
Huzzah ESP 8266 output:
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.2 on ESP-12
[62] Connecting to 192.168.199.201:8080
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
connected with [SSID Redacted], channel 6
dhcp client start...
ip:192.168.199.119,mask:255.255.255.0,gw:192.168.199.1
[5063] Connecting to 192.168.199.201:8080
[10064] Connecting to 192.168.199.201:8080
pm open,type:2 0
[15065] Connecting to 192.168.199.201:8080
[20066] Connecting to 192.168.199.201:8080
Etc. etc. etc.
NodeMCU ESP output:
SDK:2.2.1(cfd48f3)/Core:2.4.1/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1)
scandone
[73]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.2 on NodeMCU
[81] Connecting to 192.168.199.201:8080
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt
connected with [SSID Redacted], channel 6
dhcp client start...
ip:192.168.199.121,mask:255.255.255.0,gw:192.168.199.1
[5082] Connecting to 192.168.199.201:8080
[5227] <[02|00|01|00] [Auth Code Redacted]
[5263] >[00|00|01|00|C8]
[5263] Ready (ping: 35ms).
[5263] Free RAM: 43800
[5330] <[11|00|02|00]Hver[00]0.5.2[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]NodeMCU[00]build[00]May 21 2018 20:51:50[00]
[5344] >[00|00|02|00|C8]
pm open,type:2 0
[15332] <[06|00|03|00|00]
[15345] >[00|00|03|00|C8]
I moved your issue into your own topic, and cleaned up the post for proper forum viewing.
However, I have no ideas as to the issue, sorry
Thanks @Gunner. I was successful using my NOIP hostname in lieu of the IP address, but I had to open port 8080 on my router, so the traffic goes out and loops back in; but that is what I wanted to avoid by using a local server. Bottom line, the Huzzah will not connect using the IP address and I am to the point of swapping it for the less expensive NodeMCU that appears to work better.