To complete your application, the main.cpp file should also be modified to process the data on the virtual pin. These steps show you how to modify it with the nano editor:
- Open the main.cpp file with nano by issuing the following command:
pi@raspberrypi:~/blynk-library/linux $ sudonanomain.cpp
- Before using the WiringPi GPIO library, you need to include its header file in your program as follows:
- Scroll down to the file with the arrow keys on your keyboard and add the following code to the setup() function:
Blynk.begin(auth, serv, port);
The pinMode() function allows you to set the mode of a pin to either INPUT, OUTPUT, or PWM_OUTPUT. Note that only WiringPi pin 1 (BCM_GPIO 18) supports PWM output.
- Then, add the following lines to the BLYNK_WRITE(V1...