Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Internet of Things with Blynk

You're reading from   Hands-On Internet of Things with Blynk Build on the power of Blynk to configure smart devices and build exciting IoT projects

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781788995061
Length 271 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Pradeeka Seneviratne Pradeeka Seneviratne
Author Profile Icon Pradeeka Seneviratne
Pradeeka Seneviratne
Arrow right icon
View More author details
Toc

Connecting Raspberry Pi with Blynk Cloud

After completing the building process, you can run the sample C++ code to connect your Raspberry Pi with the Blynk Cloud through Wi-Fi:

  1. Run the default source code file, which is main.cpp, with the following command:
pi@raspberrypi:~/blynk-library/linux $sudo ./blynk --token=da999e8ef4ac42148f9f e8427d482451
  1. When you run the command sudo ./blynk --token=da999e8ef4ac42148f9fe8427d482451, the main.cpp file residing in the blynk-library/linux directory gets executed. The sample code only connects to the Blynk server at https://www.blynk.cc/. The output should look something like this:
Output for default file main.cpp
  1. You can find the sample code for main.cpp in the blynk-library/linux directory. You can read the content of the file with the following command:
pi@raspberrypi:~/blynk-library/linux $ cat main.cpp
  1. The output should look something similar to what is on this link: https://github.com/PacktPublishing/Hands-On-Internet-of-Things-with-Blynk/blob/master/Chapter%201/Listing%201-1/main.cpp.
  2. Go through the code and see whether you can understand the key functions. Don't worry, you will learn how to write C++ code for the Blynk application in Chapter 3, Using Controller Widgets.
  3. Now exit from the nano editor by pressing Ctrl + X with your keyboard. The editor will prompt you asking if you want to save the file; type Y in response.
You have been reading a chapter from
Hands-On Internet of Things with Blynk
Published in: May 2018
Publisher: Packt
ISBN-13: 9781788995061
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image