After completing the building process, you can run the sample C++ code to connect your Raspberry Pi with the Blynk Cloud through Wi-Fi:
- Run the default source code file, which is main.cpp, with the following command:
pi@raspberrypi:~/blynk-library/linux $sudo ./blynk --token=da999e8ef4ac42148f9f e8427d482451
- 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
- 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
- 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.
- 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.
- 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.