Button behavior with adafruit HUZZAH

I have just started playing around with BLYNK. I received a few adafruit HUZZAH boards yesterday and today hooked one up to the standard blynk esp8266 example. I set up a button to interact with GPIO0 and/or GPIO2 (which have red and blue LED’s built in). I have the buttons set up as either a pushbutton or a switch. When I run the blynk app on my iPhone the appropriate LED(s) turns on (but not until I connect with iPhone app) but then LED stays on. It does not turn on or off, it just stays on whether I press button or not. Changing to a slider has the same effect (it’s a PWM pin so I assume should dim/brighten). Behavior is the same if I change board definition to generic ESP8266.

Clearly blynk is connecting because the correct LED lights up when connects (and serial monitor confirms it’s connected to blynk). For whatever reason, however, it does not respond appropriately to button presses.

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "**************************";

const char* ssid     = "******";
const char* password = "********";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, password);
}

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

@alangstein can you explain in more detail what you mean by “When I run the blynk app on my iPhone the appropriate LED(s) turns on (but not until I connect with iPhone app) but then LED stays on.”

Surely you were expecting to have to connect the iPhone app for the LED’s to respond?

I am always quite wary when it comes to dual purpose pins i.e. builtin LED’s and boot up mode etc.
To test your system I would attach an LED to a ‘regular’ pin. You could then go back to trying the dual purpose pins.

  1. Load blynk sketch onto HUZZAH (esp8266)
  2. Reset board (connection to blynk confirmed in serial port)
  3. In blynk app open project with a single button set to GP2
  4. Touch triangle top right of app/project

At this point built in blue LED (GPIO2) turns on and does not respond to actions to the button in the blynk ios app.

If button is set to GP0 instead of GP2 then red LED (GP0 built in LED) turns on instead of blue LED
If two buttons are created - one for GP0 and one for GP2 then both LED’s turn on

Tried setting button to other GP (GP5, GP15) and hooked up LED to them. No response at all.

Ran the standard blink for ESP8266 sketch (not blynk) and was able to get appropriate LED’s blinking (GP0, GP2, GP5, GP15 whatever was programmed)

So the standard Blynk sketch works fine and some other sketch doesn’t, right?

If this is the case then you take the standard sketch and add details a bit at a time until it stops working. At this point you know what the problem is.

Sorry, you have it reversed.

The standard BLINK (i.e. LED’s blinking on/off) works fine. That is not a BLYNK sketch. The standard BLINK sketch is like the “hello world” of arduino programming - just get an LED to blink. It does not call BLYNK at all, just sets pin to HIGH, delays, then sets pin to LOW, then delay again.

The standard BLYNK sketch does NOT work (see my description prior response)

Ok I am with you now.

Maybe add #define BLYNK_DEBUG as the first line of your sketch and let us know what Serial Monitor shows when you press the buttons in the app.