Blynk 2.0 and Nano 33 IoT

Hi I have two Arduino Nano 33 IoT working on the old Blynk platform, monitoring and watering plants.
I am trying to connect the Nono 33 IoT to the new Blynk 2.0 with out any success!

  • I have made a new Blynk 2.0 account
  • I have tried to use the quick-start in Blynk.cloud/dashboard to make a functional code, did not work.
  • I have tried to get code with “examples.blynk.cc” nothing will compile with the Nano 33!
  • I have tried the Blynk.Edget in Arduino IDE / Examples, did not compile as well.

I can make a connection with ESP 32 with good success but I want to use Arduino Nano because I have designed a shield for it plus a documentation. Can some one help me?
Regards Villi

Not without some much more specific information about what EXACT issues you are experiencing, the code you are using, the error messages you are seeing etc etc.

Pete.

Thank you for replying - In Quick start I was using this code to try to get a connection with the Nano 33 IoT.

#define BLYNK_TEMPLATE_ID           "XXXXXXXXXXXXX"
#define BLYNK_DEVICE_NAME           "Quickstart Device"
#define BLYNK_AUTH_TOKEN            "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"


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


#include <SPI.h>
#include <WiFi101.h>
#include <BlynkSimpleWiFiShield101.h>

char auth[] = BLYNK_AUTH_TOKEN;

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

BlynkTimer timer;

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

  // Update state
  Blynk.virtualWrite(V1, value);
}

// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
  // Change Web Link Button message to "Congratulations!"
  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}

// This function sends Arduino's uptime every second to Virtual Pin 2.
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V2, millis() / 1000);
}

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

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

  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
  Blynk.run();
  timer.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

I got this errors:

In file included from c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\char_traits.h:39:0,
                 from c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\string:40,
                 from c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\stdexcept:39,
                 from c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\array:39,
                 from c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\tuple:39,
                 from c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\functional:54,
                 from C:\Users\vilhjalmurm\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkTimer.h:39,
                 from C:\Users\vilhjalmurm\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkApi.h:37,
                 from C:\Users\vilhjalmurm\Documents\Arduino\libraries\blynk-library-master\src/BlynkApiArduino.h:14,
                 from C:\Users\vilhjalmurm\Documents\Arduino\libraries\blynk-library-master\src/Adapters/BlynkWiFiCommon.h:24,
                 from C:\Users\vilhjalmurm\Documents\Arduino\libraries\blynk-library-master\src/BlynkSimpleWiFiShield101.h:19,
                 from C:\Users\vilhjalmurm\Desktop\TEMP\TEMP.ino:20:
c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
c:\users\vilhjalmurm\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
exit status 1
Error compiling for board Arduino NANO 33 IoT.

Choosing “Arduino” as your board type and “WiFi” as your connection type in the QuickStart wizard probably isn’t going to generate code that will work with your specific Arduino board.

Pete.

Yes Choosing Arduino as a board type and WiFi. So Arduino Nano 33 IoT is not and will not be supported?

I didn’t say that, just that the code provided by that wizard when you choose “Arduino” probably isn’t going to generate code that will work for your specific Arduino variant.

If you take a look at the list of supported boards then yours is included…

https://docs.blynk.io/en/blynk.edgent-firmware-api/supported-boards

Pete.

for Nano IoT use MKR WiFi 1010 examples.

new Blynk cloud uses the same Blynk library as old Blynk cloud so how it compiles for old Blynk and doesn’t for new?

1 Like

I am connected with Blynk 2:0 with my old code. Thank you your comment opened my eyes :wink:

I manage to connect the Arduino Nano 33 IoT with the new Blynk 2:0 This is my code:


#define BLYNK_TEMPLATE_ID           "TMPLlIYEGdKX"
#define BLYNK_DEVICE_NAME           "Quickstart Device"
#define BLYNK_AUTH_TOKEN            "i6_6RtubQuDG9EtBEIE1h2Y6vOX__yVG"

//Aukaforrit=library fyrir kóða__________________________________________________________________

#define BLYNK_PRINT Serial
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>
#include <SPI.h>  // Þarf ekki þetta safn

// Auto Token ________________________________________________________________________
//char auth[] = "e7EWNTmRObb3r1k68lYIRXP-R5YqZwV5"; //HVITTBOX
char auth[] = BLYNK_AUTH_TOKEN;

// Þitt WIFI _________________________________________________________________________

//char ssid[] = "HFN-Gestir";          // ÞRÁÐLAUST NET HEITI
//char pass[] = "Net.fyrir.Gest!";    // Leyniorð
//char ssid[] = "FAS1";  
//char pass[] = "fasergodur";
char ssid[] = "ard-net";
char pass[] = "";     
//char ssid[] = "Siminn542879";
//char pass[] = "4DE63BF795";

// Relay pinni __________________________________________________________________________
const int Relay_pin = 8; 

// Snúningstakki skilgreining ___________________________________________________________
const int Snuningstakki = A0;
int lesa_takki_fasti;    
int skrifa_takki_fasti;  

// Rakaskynjari skilgreining ____________________________________________________________
const int RakaSensor =  A1; // Pinni fyrir rakaskynjara er A1
int RakaFasti;
const int dry = 718; // Hæsta gildi rakaskynjara
const int wet = 316; // Lægsta gildi rakaskynjara

// Flotskynjari skilgreining ____________________________________________________________
const int Float_sensor = 7;   //Flot skynjari er skráður á pinna 7.
int Float_fasti = 0;          //fasti eða gildi sem lesturinn skynjarans færist á.   

// RGB LED peru skilgreining ____________________________________________________________

const int LED_RED = 3; //rauður
const int LED_BLUE = 4; //blár
const int LED_GREEN = 5; //grænn

const int resetPin = 2; // Til að geta endurræst Arduino eftir þörfum.


BlynkTimer timer; // Keyra upp "BlynkTimer" til að halda öllu í réttri tímaröð 

// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
  // Change Web Link Button message to "Congratulations!"
  Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
  Blynk.setProperty(V3, "onImageUrl",  "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
  Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}




WidgetLCD lcd(V2); // Keyra upp stuðning fyrir stafrænan LCD skjá fyrir Blynk á stafrænan pinna V2.



// Þessi loopa sendir upplýsingar á serverinn á 1 sec frestii____________________________

void sendFlagToServer() {

lesa_takki_fasti = analogRead (Snuningstakki);  // Lesa snúningstakka pinnann
skrifa_takki_fasti = (255./1023.) * lesa_takki_fasti;  // Breyta gildunum í 0 til 255.


RakaFasti = analogRead(RakaSensor);  // Lesa rakaskynjara pinnnann
Serial.println(RakaFasti);
int Rakastig = map(RakaFasti, wet, dry, 100, 0);  // Breyta gildunum í 0 til 100 %.

if(Rakastig >= 100)
{
  Serial.println("100 %");
}
else if(Rakastig <=0)
{
  Serial.println("0 %");
}
else if(Rakastig >0 && Rakastig < 100)
{
  Serial.print(Rakastig);
  Serial.println("%");
  
}



Float_fasti = digitalRead (Float_sensor); //Lesa flotskynjarann og færa yfir í Float_fasti





Blynk.virtualWrite(V4,Rakastig);  // Senda gildi rakaskynjarans á Blynk á stafrnæna pinna V4
Blynk.virtualWrite(V5,Float_fasti);  // Senda gildi flotskynjarans á Blynk á stafrnæna pinna V5

 
// Þessi if loopa stýrir LED perunum miðað við stöðu flotskynjarans.

if (Float_fasti ==0) //HVÍTUR 0 , GRÆNN 1 
  {
  analogWrite (LED_GREEN,0);
  digitalWrite (LED_RED,HIGH);

            }

else {
 
    analogWrite (LED_GREEN,skrifa_takki_fasti);
    digitalWrite (LED_RED,LOW);

}
}

// Þessi if loopa sendir lcd tilkynningu á Blynk appið miðað við stöðu flotskynjarans.

void sendFlag2ToServer() {


if (Float_fasti ==1) //HVÍTUR 0
  {
 
  lcd.clear ();
  lcd.print(1, 0, "G-KERFI:");
  lcd.print(1, 1, "VATN-ON");
            }

else {
 

    lcd.clear ();
    lcd.print(1, 0, "FORÐABÚR:");
    lcd.print(1, 1, "Vatn vantar");

Serial.println ("Rakaskynjari");
Serial.print (Float_fasti);

}
}

// Forrit bíður eftir skipun frá Blynk appi (V1) kveikja eða slökkva á dælu.
 
BLYNK_WRITE(V1) {

  long Relay_Value = param[0].asLong();

      if (Relay_Value !=0)
            {
            digitalWrite (Relay_pin,HIGH);
            Blynk.virtualWrite(V7,255); 
            }
            
      else { 
            digitalWrite (Relay_pin,LOW);
            Blynk.virtualWrite(V7,0);
           }
}


BLYNK_WRITE(V8) // Til að geta endurræst tölvuna frá Bynk með stafrnænapinnaum V8
{
if (param.asInt()==1) {

digitalWrite (resetPin,LOW);
delay(5000);

}
}

// Uppsetning forrits, Blynk, serial, pinnar og tími uppsettur.

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

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

  // Setup a function to be called every second
  timer.setInterval(1000L, sendFlagToServer);
  timer.setInterval(9950L, sendFlag2ToServer);

  
  pinMode(Relay_pin, OUTPUT);
  pinMode(RakaSensor, INPUT);
  pinMode (Snuningstakki, INPUT);
  pinMode(Float_sensor,INPUT_PULLUP);

  pinMode (LED_BLUE,OUTPUT);
  pinMode (LED_RED,OUTPUT);
  pinMode (LED_GREEN,OUTPUT);

  pinMode (resetPin,OUTPUT);

  digitalWrite (resetPin,HIGH);

digitalWrite (LED_BLUE,HIGH);
delay (200);
digitalWrite (LED_BLUE,LOW);
delay (200);
digitalWrite (LED_BLUE,HIGH);
delay (200);
digitalWrite (LED_BLUE,LOW);
delay (200);
digitalWrite (LED_BLUE,HIGH);
delay (200);
digitalWrite (LED_BLUE,LOW);
delay (30);

// Serial.print ("Reset");
}

// Meginn loopan inniheldur aðeins Blynk run og timer run.
void loop()
{
  Blynk.run();
  timer.run();

}