BRLAB DOCS
HomeTutorialsHardware
IoT Relays with Particle and Blynk
IoT Relays with Particle and Blynk
  • Introduction
  • Getting Started
    • What You Will Need
    • Claim Your Particle Device
    • Setup Your Blynk Account
  • Creating the Web Dashboard
    • Template
    • Data Streams
    • Widgets
    • Widget Settings
    • Finished Web Dashboard
  • Creating the Mobile App
    • Blynk.App
    • Widgets
    • Widget Settings
  • The App Code
    • Particle Web IDE
    • Blynk Library
    • Writing The Code
      • Comment Header
      • Define Blynk Objects
      • Define Global Variables
      • Void Setup()
      • Void Loop()
      • BLYNK_WRITE()
    • Application Code
    • Control The World Around You
  • Resources
    • Blynk Documentation
    • Particle Documentation
Powered by GitBook
On this page
  1. The App Code
  2. Writing The Code

Define Blynk Objects

The first thing we will need to do is to define the Blynk objects that give authentication to the Blynk cloud and connect the template. This is where we will copy and paste the firmware configuration code that we discussed earlier.

You will also need your device Authentication Token which can be found in device info.

Place this at the head of your code under your comment header.

// Firmware Configuration
#define BLYNK_TEMPLATE_ID "Enter your template ID here"
#define BLYNK_DEVICE_NAME "Enter your device name here"
#define BLYNK_AUTH_TOKEN  "Enter your device auth token here"

#include <blynk.h> //Blynk library 

We added the Blynk library in a early step, just move it down below your firmware configuration definitions.

PreviousComment HeaderNextDefine Global Variables

Last updated 2 years ago