Convert legacy blynk code to blynk iOT

Duplicated lines of code!

Delete this, it’s misleading.

You need to remove “GPIO” and simply have the pin numbers…

    digitalWrite(5, HIGH);
    digitalWrite(4, HIGH);
    digitalWrite(0, HIGH);
    digitalWrite(13, HIGH);

But a better wat woiuld be like this:
Near the top of your code, after the #include "BlynkEdgent.h" line of code, define aliases for your pins, like you have here, where you give pin 16 the alias “ledPower”…

then use this alias when you reference the pin in your code, like you do here…

This makes the code easier to understand and debug, but also makes it easier to change which pins you are using because you only need to make one change at the top of your code rather than doing search and replace operations on the sketch.

More duplication, you only ned one of these. If you’re using a NodeMCU then a baud rate of 74880 is usually best, as this is usually the native baud rate of the board and it allows you to view both the boot messages from the board and the serial debug messages without changing baud rates in your serial monitor.
For an ESP32 a baud rate of 115200 is best.

As @John93 mentioned, this now needs to be changed so that it logs an event that has a notification attached to it. There is a limit of how many times each event type and notification can be triggered each day (100 times in a 24 hour period), and your code would lof an event each time sendSensor is called and this ‘if’ statement is true…

This could lead yo you quickly running out of events/notifications for the day. The way around this is to use a “flag” variable as described here…

But, your sendWifi and sendSensor functions aren’t being called at the moment, because you missed-out these lines in your void setup:

  timer.setInterval(10000L, sendWifi);
  timer.setInterval(1000L, sendSensor); <<< Change to at least 5000L

Pete.