Window cannot print messages

BLYNK_WRITE(V12)
{
  if (param.asInt() == 0)
  {
    Serial.println("111111111");
  }
  if (param.asInt() == 1)
  {
    Serial.println("2222222222");
  }
}

Cannot print message such as "1111111111111"or“22222222222”

@shuaiqi “something” has to == 0

The param.asInt() function has to have an Integer to work with.

Try this:-

BLYNK_WRITE(V12) 
{ 
  int someThing = param.asInt();
  if (someThing == 0)
 {     
Serial.println("11111111");
  }
 else if (someThing == 1)
 {     
Serial.println("22222222");
  }
}

Richard

#define BLYNK_PRINT Serial


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

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "HiWiFi_0EC3A4";
char pass[] = "test1234";

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

  //Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  Blynk.begin(auth, ssid, pass, IPAddress(47,24******), 8080);
}
BLYNK_WRITE(V111)
{
  int someThing = param.asInt();
  if (someThing == 0)
  {
    Serial.println("5555555555555");
  }
 else if (someThing == 1)
  {
    Serial.println("666666666666");
  }
}
void loop()
{
  Serial.println("dddddd");
  Blynk.run();
}

I can’t print out 555555555 or 6666666
Please help me, thank you very much.

I think you need to go right back to the beginning.

Learn how format your code properly for this forum as detailed when you started this post i.e. use 3 back ticks + ccp at the beginning and 3 back ticks at the end. Your code should look like my example.

Learn about program construction i.e. what to put in Setup (this will only be run once at startup) Your BLYNK_WRITE(V111) will only run once!

Learn about what you can and cannot put in the loop() function. Serial.println(“dddddd”) will try to print 100’s of times a second.

Have a look at some Blynk examples regarding wifi and Blynk connection.

Richard

The problem is that nothing can be printed

I am confused

This can’t print 0 or 1, I don’t know where the error occurred, please help me. Normally it can be printed, maybe my system is wrong?

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on NodeMCU.

  Note: This requires ESP8266 support package:
    https://github.com/esp8266/Arduino

  Please be sure to select the right NodeMCU module
  in the Tools -> Board menu!

  For advanced settings please follow ESP examples :
   - ESP8266_Standalone_Manual_IP.ino
   - ESP8266_Standalone_SmartConfig.ino
   - ESP8266_Standalone_SSL.ino

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

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


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

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "HiWiFi_0EC3A4";
char pass[] = "test1234";

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

  //Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
   Blynk.begin(auth, ssid, pass, IPAddress(4*********,65), 8080);
}

BLYNK_WRITE(V123)
{
    int prinValue = param.asInt();
    Serial.println(prinValue);
  }

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

@shuaiqi you’ve been asked twice to format your code so that it displays correctly - once in the template text that you deleted when creating your first post, and then again by @rha10

Please go back to your posts that contain code and edit them, by clicking on the pencil icon at the bottom of each post, and add-in the trippier backticks ``` at the top and bottom of your code.

Blynk%20-%20FTFC

If you don’t do this then your code will be deleted.

Thank you.

Pete.

I took pity and did it for the OP :wink:

You’re getting soft in your old age!

Pete.

1 Like

I found the reason, it was a server problem (my own server), my server version is 41.1. I did not see this phenomenon with the blynk server, so I want to update my server. How do I update the server? What do I need to do before updating? Thank you very much for your patience!~

I found the reason, it was a server problem (my own server), my server version is 41.1. I did not see this phenomenon with the blynk server, so I want to update my server. How do I update the server? What do I need to do before updating? Thank you very much for your patience!~。。。