Hi
this is my first time using Blynk. I have been trying for days now to get it to work,but am unable to.
I am using a Teensy 4.1 with the built in Ethernet controller for a hard wired network connection. I am using a local server.
I get the same results as the following user My project offline
The serial monitor shows that it is connected and ready
Start NativeEthernet_WM_Config_Teensy on TEENSY 4.1 with Teensy 4.1 NativeEthernet Library
BlynkEthernet_WM v1.5.0
=========================
Default SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
=========================
setCsPin:10
test1
[621] MAC:***************
[8784] IP:172.16.1.85
[8784] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.0 on TEENSY 4.1
[8785] Connecting to 172.16.1.34:8080
[8795] Ready (ping: 9ms).
and in the log of my local server
18:45:06.401 DEBUG- completeLogin. [id: 0xd9b91bbf, L:/172.16.1.34:8080 - R:/172.*.*.*:49153]
18:45:06.402 INFO - *************@shaw.ca hardware joined.
18:45:06.470 DEBUG- Changing read timeout interval to 104
I have tried using blynk.connect instead of blynk.begin. no success
tried with and without Use_Blynk_wm, with and without use_local_server, and setting the server credentials to match my local server, thinking that it might be applying settings somewhere else.
the farthest I can get is showing Ready.
I am using an android phone, setup a project and got the keys. if I change the keys in the sketch, it shows that the key does not match. so I know it is connecting to the project.
in that other thread, he said to look thru examples, etc. I can not find any examples of a teensy4.1 using onboard ethernet to a local server. I started with the NativeEthernet_WM_config_Teensy. and tried other sketches in the BlynkEthernet_manager library, but am unable to get any farther than this
is anyone able to help?
Thanks
Brent
#include <SPI.h>
#include "defines.h"
#include "Credentials.h"
char auth1[] = "****";
char server1[] = "172.16.1.34";
 #define port1    8080
//unsigned int localIP = "172.16.1.25";
byte mac[] = {0x**,0x**,0x**,0x**,0x**,0x**};
IPAddress ip (172,16,1,25);
IPAddress dns (172,16,1,254);
IPAddress gateway (172,16,1,254);
IPAddress subnet (255,255,255,0);
BlynkTimer timer;
#if USE_BLYNK_WM
  
  #include "dynamicParams.h"
  #define BLYNK_PIN_FORCED_CONFIG           V10
  #define BLYNK_PIN_FORCED_PERS_CONFIG      V20
// Use button V10 (BLYNK_PIN_FORCED_CONFIG) to forced Config Portal
BLYNK_WRITE(BLYNK_PIN_FORCED_CONFIG)
{ 
  if (param.asInt())
  {
    Serial.println( F("\nCP Button Hit. Rebooting") ); 
    // This will keep CP once, clear after reset, even you didn't enter CP at all.
    Blynk.resetAndEnterConfigPortal(); 
  }
}
// Use button V20 (BLYNK_PIN_FORCED_PERS_CONFIG) to forced Persistent Config Portal
BLYNK_WRITE(BLYNK_PIN_FORCED_PERS_CONFIG)
{ 
  if (param.asInt())
  {
    Serial.println( F("\nPersistent CP Button Hit. Rebooting") ); 
   
    // This will keep CP forever, until you successfully enter CP, and Save data to clear the flag.
    Blynk.resetAndEnterConfigPortalPersistent();
  }
}
#endif
void readAndSendData()
{
  float temperature = 25.5;
  float humidity    = 50.0;
  if (Blynk.connected())
  {
    if (!isnan(temperature) && !isnan(humidity))
    {
      Blynk.virtualWrite(V17, String(temperature, 1));
      Blynk.virtualWrite(V18, String(humidity, 1));
    }
    else
    {
      Blynk.virtualWrite(V17, F("NAN"));
      Blynk.virtualWrite(V18, F("NAN"));
    }
  }
  // Blynk Timer uses millis() and is still working even if WiFi/Blynk not connected
  Serial.print(F("R"));
}
void heartBeatPrint()
{
  static int num = 1;
  if (Blynk.connected())
    Serial.print(F("B"));
  else
    Serial.print(F("F"));
  if (num == 40)
  {
    Serial.println();
    num = 1;
  }
  else if (num++ % 10 == 0)
  {
    Serial.print(F(" "));
  }
}
void check_status()
{
  static unsigned long checkstatus_timeout = 0;
#define STATUS_CHECK_INTERVAL     60000L
  // Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
  {
    heartBeatPrint();
    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
  }
}
void setup()
{
  // Debug console
  Serial.begin(9600);
  while (!Serial);
  delay(200);
  
  Serial.print(F("\nStart NativeEthernet_WM_Config_Teensy on ")); Serial.print(BOARD_NAME);
  Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
  
#if USE_BLYNK_WM 
  Serial.println(BLYNK_ETHERNET_WM_VERSION);
#endif
  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
  #if USE_ETHERNET_WRAPPER
    EthernetInit();
  #else
    #if USE_ETHERNET
      Serial.println(F("=========== USE_ETHERNET ==========="));
    #elif USE_ETHERNET2
      Serial.println(F("=========== USE_ETHERNET2 ==========="));
    #elif USE_ETHERNET3
      Serial.println(F("=========== USE_ETHERNET3 ==========="));
    #elif USE_ETHERNET_LARGE
      Serial.println(F("=========== USE_ETHERNET_LARGE ==========="));
    #elif USE_ETHERNET_ESP8266
      Serial.println(F("=========== USE_ETHERNET_ESP8266 ==========="));
    #else
      Serial.println(F("========================="));
    #endif
   
      Serial.println(F("Default SPI pinout:"));
      Serial.print(F("MOSI:")); Serial.println(MOSI);
      Serial.print(F("MISO:")); Serial.println(MISO);
      Serial.print(F("SCK:"));  Serial.println(SCK);
      Serial.print(F("SS:"));   Serial.println(SS);
      Serial.println(F("========================="));
           
      // unknown board, do nothing, use default SS = 17
      #ifndef USE_THIS_SS_PIN
        #define USE_THIS_SS_PIN   17    // For other boards
      #endif
           
      Serial.print(F("setCsPin:"));
      Serial.println(USE_THIS_SS_PIN);
  
      // For other boards, to change if necessary
      #if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 )
        // Must use library patch for Ethernet, Ethernet2, EthernetLarge libraries
  
        Ethernet.init (USE_THIS_SS_PIN);
  
      #elif USE_ETHERNET3
        // Use  MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
        #ifndef ETHERNET3_MAX_SOCK_NUM
          #define ETHERNET3_MAX_SOCK_NUM      4
        #endif
        
        Ethernet.setCsPin (USE_THIS_SS_PIN);
        Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
                        
      #endif  //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE ) 
  
  #endif  //USE_ETHERNET_WRAPPER
#if USE_BLYNK_WM
  Serial.println("test1");
//  Blynk.config(auth1, server1,port1);
//  Blynk.connect();
//  Blynk.begin(auth1, server1,port1, ip, dns, gateway, subnet, mac);
  Blynk.begin(auth1, server1,port1);
//Blynk.begin("TMPLLAiTnlZf", "blynk-cloud.com");
  Serial.println("test2");
#else
  Blynk.begin(auth1, server1,port1, ip, dns, gateway, subnet, mac);
#if USE_LOCAL_SERVER
  //Blynk.begin(auth, server, BLYNK_SERVER_HARDWARE_PORT);
#else
 // Blynk.begin(auth);
  // You can also specify server:
  //Blynk.begin(auth, server, BLYNK_SERVER_HARDWARE_PORT);//
#endif
#endif
  if (Blynk.connected())
  {
    #if USE_BLYNK_WM    
    Serial.print(F("Conn2Blynk: server = "));
    Serial.print(Blynk.getServerName());
    Serial.print(F(", port = "));
    Serial.println(Blynk.getHWPort());
    Serial.print(F("Token = "));
    Serial.print(Blynk.getToken());
    Serial.print(F(", IP = "));   
#else
    Serial.print(F("Conn2Blynk: server = "));
    Serial.print(server);
    Serial.print(F(", port = "));
    Serial.println(BLYNK_SERVER_HARDWARE_PORT);
    Serial.print(F("Token = "));
    Serial.print(auth);
    Serial.print(F(", IP = "));       
#endif    
    Serial.println(Ethernet.localIP());
  }
  timer.setInterval(60000L, readAndSendData);
}
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
void displayCredentials()
{
  Serial.println("\nYour stored Credentials :");
  for (uint8_t i = 0; i < NUM_MENU_ITEMS; i++)
  {
    Serial.println(String(myMenuItems[i].displayName) + " = " + myMenuItems[i].pdata);
  }
}
void displayCredentialsInLoop()
{
  Serial.println("test");
  static bool displayedCredentials = false;
  if (!displayedCredentials)
  {
    for (uint8_t i = 0; i < NUM_MENU_ITEMS; i++)
    {
      if (!strlen(myMenuItems[i].pdata))
      {
        break;
      }
      if ( i == (NUM_MENU_ITEMS - 1) )
      {
        displayedCredentials = true;
        displayCredentials();
      }
    }
  }
}
#endif
void loop()
{
  Blynk.run();
  timer.run();
  check_status();
#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
  displayCredentialsInLoop();
#endif 
}