Migrating from old code, rough go, very basic problems

I am moving things to the new platform and all of a sudden am having the most basic of issues. I’ve paired this code down to almost nothing and it’s not working. All I am trying to do is print output to serial monitor when Virtual Button V6 is pressed (ESP8266 D1 mini). Help me see the obvious?

*************************************************************
Most Basic VPIN example possible
 *************************************************************/
 
// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID           ""
#define BLYNK_DEVICE_NAME           ""
#define BLYNK_AUTH_TOKEN            ""


// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <E131.h>

#define VPIN_BUTTON_6 V6

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "";
char pass[] = "";

bool Up = false;
bool Down = false;

BlynkTimer timer;
//const int universe = 21; // this sets the universe number you are using.


// This function is called every time the Virtual Pin 6 state changes
BLYNK_WRITE(V6)
{
  // Set incoming value from pin V6 to a variable
  int value = param.asInt();

  // Update state
  Blynk.virtualWrite(V6, value);
  Down = param.asInt();
  Serial.println("V6");

}


void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);

}

void loop()
{
  
  Blynk.run();  

  if (Down){                                          // if condition 
  
  Serial.println("Going Down");
  }

}

You might have pared you code down, but there’s still a lot of redundant stuff in there,

First of all, you need to define what “Not Working” means from your point of view.
Is the device connecting to Blynk?
Are you seeing any serial output?
Is that serial output changing at all when you press the widget button attached to datastream V6?

I have some questions though…

  1. how is your V6 datastream configured?
  2. How is your button wiudget attached to pin V6 configured? (Push, Switch)
  3. why are you doing this:

Pete.

Thanks Pete. Nothing is being output at all to the monitor. After the hard reset I get nothing, and nothing on button press. What can I add to see if it’s connecting to Blynk? would that be putting Blynk.begin(auth, ssid, pass); in an if statement?

As far as the datastream it’s just configured for PIN v6, datatype int
The button is a switch type (although I did try Push type as well) tied to datastream above
The Blynk.virtualWrite(V6, value); was me trying to force anything at all to happen

I think my problem is that all my “working” stuff is intermingled with a bunch of e1.31 stuff that I am very familiar with - for example, this works: https://github.com/crypnapetr/smart_e131/blob/main/E131_SINGLE_RELAY_e1e1_and_wifi.ino

but now trying to just use Blynk alone I am struggling to find a baseline that works.

Okay, well that’s the first thing you need to focus on.

The native baud rate for the Wemos D1 mini is 74880 so I’d suggest that you change this:

to this:

Serial.begin(74880);

Then make sure that your serial monitor is set to 74880 s well.

When you have the correct COM port selected and you hit the Wemos’s reset button you should see something like this…

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v00050ee0
~ld

If you don’t then you you may have a faulty board, a faulty serial cable or missing/corrupted drivers.

Do you gear the chime noise from your PC when the board is plugged-in, and do you see the serial port in your IDE?

Pete.

No

That achieves nothing

Pete.

Wow, thanks Pete. You helped me indirectly here and I thank you. So I had also upgraded to the new Arduino IDE and didn’t realize the Serial Monitor and Output were on dif tabs (used to the serial monitor being in it’s own window). I was looking in the wrong place for the monitor. (bangs head). Thank you, it works now (and I removed the useless write).

1 Like