Hello,
i would like to execute on my raspberry a command and save it to a variable to show it on my blynk app.
what is working so far:
BLYNK_WRITE(V5)
{
int state = param.asInt();
if ( state == 1)
{
system(" lp -d Zebra_Technologies_ZTC_GK420d /home/pi/Blynk/Projects/Zebra_Empty_file_Print.txt");
}
}
but i also want to do something like this which is not working:
BLYNK_WRITE(V6)
{
int state = param.asInt();
if ( state == 1)
{
int zebra_count = 0;
zebra_count = system("lpstat -o Zebra_Technologies_ZTC_GK420d | wc -l");
Blynk.virtualWrite(V7, zebra_count);
}
}
if this does not work, is there a way to read like a .txt file and save it to a variable?