Hey guys,
today I learned about Blynk and the possibility to controle my Raspberry Pi via smartphone. I tried to install the necessery libraries for my pi but im getting an error. Im using the Raspberry Pi 3 and the Raspian OS istalled with NOOBS. For my project i want to code in C++ and use the Inputs from my smartphone.
I followed the instructions in the readme file from github.
It says that i should use following commands to install the library:
Connect your Raspberry Pi to the internet and open it’s console.
I already installed wiringPi for some previous projects so I skiped this step. When I try to run the
$ make clean all target=raspberry
command Im getting a few errors:
pi@raspberrypi:~/blynk-library/linux $ make clean all target=raspberry
rm main.o BlynkDebug.o …/src/utility/BlynkHandlers.o …/src/utility/BlynkTimer.o blynk
rm: cannot remove ‘main.o’: No such file or directory
rm: cannot remove ‘BlynkDebug.o’: No such file or directory
rm: cannot remove ‘…/src/utility/BlynkHandlers.o’: No such file or directory
rm: cannot remove ‘…/src/utility/BlynkTimer.o’: No such file or directory
rm: cannot remove ‘blynk’: No such file or directory
Makefile:64: recipe for target ‘clean’ failed
make: [clean] Error 1 (ignored)
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY main.cpp -o main.o
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY BlynkDebug.cpp -o BlynkDebug.o
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY …/src/utility/BlynkHandlers.cpp -o …/src/utility/BlynkHandlers.o
g++ -I …/src/ -I ./ -DLINUX -c -O3 -w -DRASPBERRY …/src/utility/BlynkTimer.cpp -o …/src/utility/BlynkTimer.o
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::init()’:
…/src/utility/BlynkTimer.cpp:47:46: error: ‘memset’ was not declared in this scope
memset(&timer[i], 0, sizeof (timer_t));
^
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::deleteTimer(unsigned int)’:
…/src/utility/BlynkTimer.cpp:216:52: error: ‘memset’ was not declared in this scope
memset(&timer[timerId], 0, sizeof (timer_t));
^
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::enableAll()’:
…/src/utility/BlynkTimer.cpp:264:42: error: ‘numRuns’ was not declared in this scope
if (timer[i].callback != NULL && numRuns[i] == RUN_FOREVER) {
^
…/src/utility/BlynkTimer.cpp: In member function ‘void BlynkTimer::disableAll()’:
…/src/utility/BlynkTimer.cpp:273:42: error: ‘numRuns’ was not declared in this scope
if (timer[i].callback != NULL && numRuns[i] == RUN_FOREVER) {
^
Makefile:70: recipe for target ‘…/src/utility/BlynkTimer.o’ failed
make: *** […/src/utility/BlynkTimer.o] Error 1
Would be very nice if someone knows a solution for this problem. Would be a pity if i could not use Blynk
The first error ‘‘memset’’ error is because cstring library was not included.
add
“#include < cstring>”
//without " and space before cstring, I cannot edit my post properly
in
blynk-library/src/Blynk/BlynkTimer.h
The other one is a typo:
in blynk-library/src/utility/BlynkTimer.cpp
on line 264 and 273
change numRuns[i]
to
timer[i].numRuns
after that run make clean all target=raspberry,
it worked for me
Thanks for the answers I managed to run it by changing the makefile. I removed the command to compile the blynktimer. For what exactly do I need the BlynkTimer ?
I guess that depends on your sketch, if you are using one (as opposed to simple direct pin control via ONOFF).
BlynkTimer is just that, a flexible timer to have commands run every few seconds/minutes, hours, etc. Run something for X much time for Y many times, and so on. It effectively replaces the blocking delay()command in Blynkified Arduino C++ sketches. As stated, I am unsure if it is compatible with WiringPi though.
I am more used to Arduino, where just looking at it sideways can be blocking thus I do not have as much RPi experience, but I don’t think blocking commands is as much of an issue due to the threading as you mentioned.
Just use the BlynkTimer for timing purposes (hmmm, again, assuming it even works in NodeJS… now I need to go and check that for myself… )
Oh yes I totally forgot that threading is not possible on the Arduino right ? Me neither I have the PI for only a few weeks now and it takes much time, effort and errors to build up a tiny bit of experience
Haha I never programmed something in javascript so I’m completely clueless
Unfortunately I have another problem with my project already
I posted another topic about the problem because it has something to to with a local server I wanted to set up. Do you have experience with those servers ?
I just found out that the BlynkTimer is fully compatible to wiringPi ! I don’t really know why the error with the BlynkTimer occurred but I reinstalled all libraries because of an error with my local server and now everything works just like intended