[Solved] Teensy + ESP shield + local server issues

Hello,
After a few days of struggling to get an esp8266-01 flashed and working with the basic blynk sketch on an Arduino Mega I have moved on to getting the esp8266 connected to an older project using teensy 3.2 that I wanted to add Blynk functionality to. I can get everything connected using the Blynk cloud servers but when I add my local Blynk server IP it never connects. I get a message in the serial monitor stating that WiFi is connected and then from there it fails to connect to my server.

Is this still the correct way for connecting to a local server using the newest version of the Blynk library?
Blynk.begin(auth, wifi, "my ssid", "my pass", "192,168,1,114",8442);

I currently have 2 other projects using the Wemos D1 mini working just fine with my local server.

Thanks in advance.

What exactly shield are you using?

I am using an esp8266-01 as a shield. It has been flashed with the correct firmware and works just fine to connect to Blynk cloud but when trying to connect to a local Blynk server nothing happens after it tells me that WiFi is connected.

Can you show your code? We didn’t test Teensy + ESP yet.

Is there a specific section of code you’d like such as the setup or loop? My current project is 829 lines of code and has some custom animations for LEDs that I prefer to keep private.

Good news is that Teensy + ESP does work with hardware serial :smile:

I just don’t understand why it works fine with Blynk cloud but not a local Blynk server.

Here is the basics of my code. Hopefully it helps.

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include "FastLED.h"
FASTLED_USING_NAMESPACE

//MSGEQ7 Defines
#define MSGEQ7_STROBE_PIN 8
#define MSGEQ7_RESET_PIN 9
#define MSGEQ7_ANALOG_PIN A0
#define NUM_FREQUENCY_BANDS 7

// Set ESP8266 Serial object
#define EspSerial Serial1
#define ESP8266_BAUD 115200
ESP8266 wifi(&EspSerial);
//int state; // Define current state
int stripMode = 1; // Mode 0- Boblight, Mode 1- Music

#define DATA_PIN 6 // Datapin
#define NUM_LEDS 259
#define LEDCOUNT 259 // Number of LEDs used for boblight
#define BLACK_THRESHOLD 65
#define BLACK CRGB(0,0,0)
#define SHOWDELAY 150 // Delay in micro seconds before showing
#define BAUDRATE 115200 // Serial port speed, 460800 tested with Arduino Uno R3
#define BRIGHTNESS 200 // Max. brightness out of 255

const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x18, 0x4D}; // Start prefix
char buffer[sizeof(prefix)]; // Temp buffer for receiving prefix data

CRGB leds[NUM_LEDS]; //FastLED array of LEDs
CRGB incomes[NUM_LEDS];
int bands[]{1,2,3,4,5,6,7};

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
//char auth[] = "token"; // For local server
char auth[] = "token"; //FOr Blynk Cloud
void loop()
{
Blynk.run();
switch (stripMode) {
case 0: FastLED.setBrightness(120);
boblight();
Serial.println("bob");
break;
case 1: msgeq7();
Serial.println("msgeq7");
break;
case 2: discostrobe();
FastLED.show();
Serial.println("disco");
break;
default: msgeq7();
break;
}
}

//BLYNK_CONNECTED() {
// if (isFirstConnect) {
// Blynk.syncAll();
// }
//}

void setup()
{
// Set up the MSGEQ7 IC
pinMode(MSGEQ7_ANALOG_PIN, INPUT);
pinMode(MSGEQ7_STROBE_PIN, OUTPUT);
pinMode(MSGEQ7_RESET_PIN, OUTPUT);
digitalWrite(MSGEQ7_RESET_PIN, LOW);
digitalWrite(MSGEQ7_STROBE_PIN, HIGH);

FastLED.addLeds<WS2812B,DATA_PIN,GRB(leds,NUM_LEDS).setCorrection(TypicalLEDStrip).setDither(BRIGHTNESS < 255);
FastLED.setBrightness(BRIGHTNESS);

Serial.begin(115200);
delay(10);
EspSerial.begin(ESP8266_BAUD);
delay(10);
//Blynk.begin(auth, wifi, "My wifi", "my pass", "192,168,1,114",8442); // This doesn't work
Blynk.begin(auth, wifi, "My wifi", "my pass"); //This works
}

maybe just replace it with “192.168.1.114” (dots instead of comas)?

So, good news. Replacing the commas with dots worked. Is this something that changed in the latest version of the library (v0.3.6)?

Also, you guys can go ahead and confirm that Teensy 3.2 + ESP8266-01 works with hardware serial in case anyone asks.

Thanks for the help.

1 Like