Raspberry Pi, Blynk and Programming in C Language

Hi! I have years of experiences with Arduino products. When I switched over from Arduino to the raspberry pi, I was using node js as a quick replacement. I never really used Python so I the simplest solution for my projects was the C programming language. I found some documentation on the internet how to integrate Blynk into node js file and start it from there. But I have no idea how to do that in C language… I already downloaded Blynk and WiringPi library and tested the library with:


sudo ./blynk --token=

It works without any problems. How can I include Blynk in the .c file? Can anyone give me some sample code? I can write further code. My current code in C(i’m still trying how things work in C):

#include <wiringPi.h>
#include <stdio.h>

const int light = 26;
const int doors = 23;
const int dht22 = 4;
const int led = 17;


int main(void)
{
wiringPiSetupGpio(); 
	
pinMode(light, OUTPUT);
pinMode(doors, INPUT);
pinMode(dht22, INPUT);
pinMode(led, OUTPUT);

while(1){		
	printf("Turned on...");
	digitalWrite(led, HIGH);
	delay(2000);
	printf("Turned off...");
	digitalWrite(led, LOW);
	delay(2000);
	}
	
	return 0;
}

Blynk works on the RPi under three currently “acknowledged” languages… finding much support or examples is another thing :stuck_out_tongue: but getting better via the community.

  • WiringPi usies C++ methods, but not all Arduino libraries or Blynk commands are supported. I also find it the more complex to setup.

  • NodeJS (Javascript) while also limited in official example support, seems to be growing… a learning curve for Blynk command integration, but otherwise js is well documented on the web.

  • Python is in Alpha support for Blynk… not much else available yet.

1 Like

So, what programming language most Blynk users use? NodeJS? What language do you recommend?

Referring to the RPi… who knows :stuck_out_tongue_winking_eye: but I personally prefer NodeJS.

Search this forum for suitable keywords like NodeJS, javascript, RPi, etc.