BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk for Beginners and help with your project


#2

@vhymanskyy, can we pin this topic somehow?


#3

Stopped before I got started (SparkFun IOT Blynk box)
#4

#5

#6

It’s posted elsewhere but just adding it here as there are still lots of Blynkers posting grotesque code.

All code snippets should be formatted

Watch the animated gif at [README] Welcome to Blynk Community!


Blynk local server on Raspverry Pi and timer widget
#7

Are you looking for help with your Blynk project?

Struggling to get your hardware connected to a Blynk server?

As you might expect Blynk developers are busy developing a great product and I’m sure they accept they need to be involved in bug fixing, but they probably have better things to do than answer the same question over and over again.

Be sure to do a thorough search of the site before asking a question that has been answered over and over again.

Looking for a quick solution to your problem?

If you don’t want to suffer needless delays I would suggest you start your post with the following details:

 1. The Blynk library version you are using.
 2. Android or iOS and the version of the OS.
 3. Server type, Local or Cloud based.
 4. If local server, which version you are using.
 5. How you powering the MCU.
 6. Has the MCU ever connected to a Blynk server (Cloud or local).
 7. The IDE you areusing, including the version number.
 8. The settings you have in the IDE for the MCU.
 9.The Arduino core version you are using.
10. The make and model of your phone.
11.Your shoe size and anything else you think is important.

You might know what phone you are using but nobody else does unless you provide the details. The assumption is always that you are using Blynk’s cloud server as most people are but ensure you actually state it in the thread.

Many threads go on and on before the OP decides to confess they are using a local server.

Once you have stated the basic details indicated above, describe your problem in detail.

1. What have you tried?
2. What did you expect to happen?
3. What actually happened?
4. Provide screenshots if applicable.
5. Provide formatted code extracts.

If you post a thread simply with “Help I have a problem” don’t expect too much help from Blynkers.

Don’t forget the site has a very impressive search facility and Google is your friend.

Let’s all try and help the developers develop.


[SOLVED] Xmas Lights
Automatic scheduler. ESP-01 with 4 Time Input Widgets
#8

as always @Costas, :pray:. You are the best


#9

A simple sketch to control relays with an ESP. Be sure to read ALL the notes. SimpleTimer is included as it is imperative for almost all Blynk sketches. Only a very experienced coder could even attempt a Blynk project using millis(). This sketch was posted in response to the “LED widget” thread at LED and LCD widgets

If anything is not clear please ask for clarification.

/*************************************************************
 LED_Relay.ino for ESP's with Blynk  http://community.blynk.cc/t/led-widget/11582/5
 Mod of PushData.ino from Ethernet to ESP by Costas 10 Feb 2017
 Control a relay and show status with virtual LED, tested on WeMos D1 Mini
 Pinout details for WeMos D1 Mini and Mini Pro https://www.wemos.cc/product/d1-mini-pro.html
 
 For active LOW relays like the onboard LED on a WeMos, 
 Swap lines at rows 41 and 47 for active HIGH relays
 
 V0 - Virtual Button in SWITCH mode
 V1 - Virtual LED
 V2 - Value Display widget demonstrating SimpleTimer, set as PUSH READING FREQUENCY

 ESP8266 slected as Device in app, not WeMos
 *************************************************************/

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

#define vRelayBtn V0
#define vLED      V1
#define vDisplay  V2 

#define vLEDHigh 255
#define vLEDLow    0
#define relayPin   2   // (D4 on WeMos, builtin LED, active LOW)

char auth[]   = "91xxxxxxxxxxxxxxxx2e22a";
char ssid[]   = "xxxxxxxxxx";
char pass[]   = "xxxxxxxxxx";
char server[] = "blynk-cloud.com";
unsigned int vRelayStatus;

SimpleTimer testingTimer;

BLYNK_WRITE(vRelayBtn) {     // Blynk app WRITES button status to server
  vRelayStatus = param.asInt();
  if(vRelayStatus == 1){
    digitalWrite(relayPin, LOW);        // see note at line 8
    Blynk.virtualWrite(vLED, vLEDHigh);
    Serial.println(F("Relay is now ON"));    
  }
  else{
    digitalWrite(relayPin, HIGH);       // see note at line 8
    Blynk.virtualWrite(vLED, vLEDLow);
    Serial.println(F("Relay is now OFF"));   
  }
}


void myTimerEvent()  // included because SimpleTimer is essential for "ALL" Blynk sketches
{
  Blynk.virtualWrite(vDisplay, millis() / 1000);        // max 10 values per second
  // any other function can also go here, perhaps read a physical button HIGH / LOW status
}

void setup()
{
  pinMode(relayPin, OUTPUT);
  Serial.begin(115200);                           // Debug console
  Blynk.begin(auth, ssid, pass, server);
  testingTimer.setInterval(1000L, myTimerEvent);  // Setup a function to be called every second
}

void loop()
{
  Blynk.run();
  testingTimer.run(); // Initiates SimpleTimer
}

Raspberry wiringPi: virtual Pin control output
LED and LCD widgets
#10

simple question - what is the purpose and function of F in the println function ?


#11

@mars compile the sketch with and without the F’s (and associated opening and closing brackets) and check program space used.

With the F’s

Sketch uses 236,641 bytes (22%) of program storage space. Maximum is 1,044,464 bytes.
Global variables use 34,560 bytes (42%) of dynamic memory, leaving 47,360 bytes for local variables.

Without the F’s

Sketch uses 236,529 bytes (22%) of program storage space. Maximum is 1,044,464 bytes.
Global variables use 34,592 bytes (42%) of dynamic memory, leaving 47,328 bytes for local variables.

Not important with a simple sketch like this one but if your code has a few thousand lines with lot’s of Serial Print’s it can make a difference.


#12

thanks Costas but I’m still not clear as to what the F does :wink:
it seems to use more memory based in your notes above.


#13

A throwback to working with Nano’s 32KB of Flash memory and just 2KB of RAM.

Dynamic memory (RAM) is much more limited than Flash (Programmable memory).

Take a look at this Arduino thread and see if that makes it clearer https://forum.arduino.cc/index.php?topic=428015.0


#14

got it thanks - the F in println forces the use of flash vs dynamic ram.


#15

I agree… and would amend that with “experienced or bullheaded coderwanabees”… which of course explains why I skipped over millis() and went right for delayMicroseconds() :stuck_out_tongue:

Great goto topic @Costas… I think I will bookmark it as well :wink:


#16

With regards to the F in print() statements… am I correct in thinking that this is only a benefit when using ‘Pre-written’ strings (actual text in-between the brackets) as opposed to variables that refer to a bunch of combined strings or other incoming data?

println(F("This Is Data! "));

vs

u = "That ";
v = "This ";
w = "Was ";
x = "Is ";
y = "Data! ";
z = "Sparta! ";

println(F(v + x + y));  // Is the F of any dynamic memory benefit here?

Aside from the fact that the variables themselve take up memory.


#17

Yes, the F macro will not accept the following based on u, v, w defined as String’s.
Serial.println(F(u + v + w));


#18

@Costas I saw that you managed to install blynk on an omega 2, I’m trying to install it following this tutorial

But I have an error in step 2 (./scripts/feeds update -a)

/bin/ash: ./scripts/feeds: not found

Could you tell me how you installed it?


#19

@Omar_Mariscal do you have a 2 or a 2+? You need a 2+ or some way of transferring the file system to a USB stick if you are using a 2 as it’s doesn’t have enough memory for all the required packages.

The link you gave is giving me a 404 error, did you mean this page https://github.com/vshymanskyy/OpenWRT-Espruino-packages

This is the tutorial I followed https://wiki.onion.io/Tutorials/blynk-library and I think there was just a minor path mod that I needed to do. The tutorial is for the Omega 1 but it worked pretty much the same for the 2+


#21

Please don’t spam multiple help requests across different threads… you have already received an answer to your question in another old thread you re-opened.


#22

Hlo Blynk Employees i think you need to prepare one ppt for blynk server how controlling happend with phone thats good for your company plz focus on it