Using virtual pins

The Value Display widget also supports virtual pins. Follow these steps to configure the Value Display widget with a virtual pin:

  1. Tap the stop button to stop the application and go back to the canvas.
  2. Tap the Value Display widget to open the Value Display Settings page.
  3. Under INPUT, tap gpio 18 PWM. From the left-hand side list, select Virtual, and from the right-hand side list, select V1.

 

  1. Tap OK. Now, your Value Display Settings page should look like the following (see the following screenshot):
Value Display settings for a virtual pin
  1. Tap the back button on the toolbar to go to the canvas page. Now, you can see the Value Display widget is configured with the virtual pin V1.
  2. Modify the main.cpp file as shown in Listing 4.2 (https://github.com/PacktPublishing/Hands-On-Internet-of-Things-with-Blynk/blob/master/Chapter%204/Listing%204-2/main.cpp). Use the commands in the previous section to locate and open the file.
  3. Save and exit the editor by pressing Ctrl + O, followed by Enter, followed by Ctrl + X.
  4. Build the C++ project using this command:
pi@raspberrypi:~/blynk-library/linux $ ./build.sh raspberry
  1. Run the C++ project using this command, with the auth token associated with your Blynk application:
pi@raspberrypi:~/blynk-library/linux $sudo ./blynk --token=ca7bed1c92214503a65de8e20164994f
  1. Now, tap the play button to start the app. The Value Display widget will show the analog reading value of the potentiometer. You can take potentiometer values between 0 and 1023.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.166.7