Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
/ Blynk_Teensy Public archive

Enable Blynk support of Teensy boards, especially latest Teensy 4.0, using WiFi, Ethernet, BT/BLE and GSM/GPRS shield

License

Notifications You must be signed in to change notification settings

khoih-prog/Blynk_Teensy

Repository files navigation

Blynk_Teensy

arduino-library-badge GitHub release GitHub contributions welcome GitHub issues



Table of Contents



Why do we need this Blynk_Teensy library

Features

To enable Blynk support of Teensy boards, especially latest Teensy 4.1/4.0



Prerequisites

  1. Arduino IDE 1.8.19+ for Arduino. GitHub release
  2. Blynk library 1.0.1+. Latest release.
  3. Teensy core 1.56 for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) boards.

Installation

The suggested way to install is to:

Use Arduino Library Manager

The best way is to use Arduino Library Manager. Search for Blynk_Teensy, then select / install the latest version. You can also use this link arduino-library-badge for more detailed instructions.

Then copy BlynkDetectDevice.h to folder ~/Arduino/libraries/Blynk/src/Blynk to overwrite the original file BlynkDetectDevice.h.

Manual Install

  1. Navigate to Blynk_Teensy page.
  2. Download the latest release Blynk_Teensy-master.zip.
  3. Extract the zip file to Blynk_Teensy-master directory
  4. Copy whole
  • Blynk_Teensy-master/src folder to Arduino libraries' directory such as ~/Arduino/libraries/.

The file BlynkSimpleShieldEsp8266_Teensy.h must be placed in Blynk libraries src directory (normally ~/Arduino/libraries/Blynk/src).

Then copy BlynkDetectDevice.h to folder ~/Arduino/libraries/Blynk/src/Blynk to overwrite the original file BlynkDetectDevice.h. By doing this, the correct board type can be displayed correctly along with Blynk logo as follows:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Teensy 4.1/4.0

not just unknown Arduino board type:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino

VS Code & PlatformIO:

  1. Install VS Code
  2. Install PlatformIO
  3. Install Blynk_Teensy library by using Library Manager. Search for Blynk_Teensy in Platform.io Author's Libraries
  4. Please visit documentation for the other options and examples at Project Configuration File


How to use

In your code, just replace

  1. BlynkSimpleShieldEsp8266.h with BlynkSimpleShieldEsp8266_Teensy.h

That's it.


Examples

  1. Teensy40_ESP8266Shield
  2. Teensy40_Serial_USB

Sample code

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

// You could use a spare Hardware Serial on boards that have it (like Mega)

#define HWSERIAL        Serial2       // Pin RX2 : 7, TX2 : 8 for Teensy 4.0

#include <ESP8266_Lib.h>

#include <BlynkSimpleShieldEsp8266_Teensy.h>

String cloudBlynkServer = "account.duckdns.org";

#define BLYNK_SERVER_HARDWARE_PORT    8080

char auth[] = "your-token";

#define SSID_MAX_LEN      32
#define PASS_MAX_LEN      64

// Your WiFi credentials.
char ssid[] = "ssid";
char pass[] = "pass";

#define EspSerial Serial2   //Serial2, Pin RX2 : 7, TX2 : 8

// Your Teensy <-> ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

void setup() 
{
  // Debug console
  Serial.begin(115200);
  delay(1000);
  Serial.println("\nStart Teensy 4.0");

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Serial.println("Start Blynk");

  Blynk.begin(auth, wifi, ssid, pass, cloudBlynkServer.c_str(), BLYNK_SERVER_HARDWARE_PORT);
}

void loop()
{
  Blynk.run();
}

and this is the terminal debug output when running the example

Start Teensy 4.0
Start Blynk
[1310] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Teensy 4.0

[1310] Connecting to HueNet1
[7876] AT version:0.40.0.0(Aug  8 2015 14:45:58)
SDK version:1.3.0
Ai-Thinker Technology Co.,Ltd.
Build:1.3.0.2 Sep 11 2015 11:48:04
OK
[15448] IP = 192.168.2.107
+CIFSR:STAMAC,5c:cf:7f:66:05:d2
[15448] Connected to WiFi
[25601] Ready (ping: 14ms).


Issues

Submit issues to: Blynk_Teensy issues


TO DO

  1. Same features for other shields such as WiFi, Ethernet, BT/BLE, GSM/GPRS.

DONE

  1. Basic support for Teensy


Contributions and Thanks

Many thanks for everyone for bug reporting, new feature suggesting, testing and contributing to the development of this library.


Contributing

If you want to contribute to this project:

  • Report bugs and errors
  • Ask for enhancements
  • Create issues and pull requests
  • Tell other people about this library

License

  • The library is licensed under MIT

Copyright

Copyright 2020- Khoi Hoang