Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (66 sloc) 2.75 KB
Download latest Blynk library here:
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials:
Sketch generator:
Blynk community:
Follow us:
Blynk library is licensed under MIT license
This example code is in public domain.
Simple e-mail example
App project setup:
E-mail Widget
Connect a button to digital pin 2 and GND
Pressing this button will send an e-mail
WARNING: You are limited to send ONLY ONE E-MAIL PER 5 SECONDS!
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
unsigned count = 0;
void emailOnButtonPress()
// *** WARNING: You are limited to send ONLY ONE E-MAIL PER 5 SECONDS! ***
// Let's send an e-mail when you press the button
// connected to digital pin 2 on your Arduino
int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"
if (isButtonPressed) // You can write any condition to trigger e-mail sending
Serial.println("Button is pressed."); // This can be seen in the Serial Monitor
String body = String("You pushed the button ") + count + " times.";"", "Subject: Button Logger", body);
// Or, if you want to use the email specified in the App (like for App Export):
//"Subject: Button Logger", "You just pushed the button...");
void setup()
// Debug console
// Send e-mail when your hardware gets connected to Blynk Server
// Just put the recepient's "e-mail address", "Subject" and the "message body""", "Subject", "My Blynk project is online.");
// Setting the button
pinMode(2, INPUT_PULLUP);
// Attach pin 2 interrupt to our handler
attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE);
void loop()