Create C,C++ Project on Raspberry Pin. Control LED
Step 1: Install Git core
Git is code repository system, where you can store and make version of code online. To use GIT
you have to install Git core in your raspberry pi.
Command To install GIT Core.
Step 2: Download code from git branch,
Once the GIT core is installed, you have to install it download the wiringPI library from git branch.
Command to download wiringPI library:
git clone git://git.drogon.net/wiringPi
git clone git://git.drogon.net/wiringPi
Step 3: Build and install wiring pi library
Once downloaded, go to directory
cd wiringPi
cd wiringPi
Then run below command.
./build
./build
Open your text editor, Nano in my case, copy following code to your editor.
#include <wiringPi.h>
int main (void)
{
printf ("Raspberry Pi blink\n") ;
if (wiringPiSetup () == -1)
return 1 ;
pinMode (0, OUTPUT) ; //
for (;;)
{
digitalWrite (0, 1) ; // On
delay (500) ; // mS
digitalWrite (0, 0) ; // Off
delay (500) ;
}
return 0 ;
}
Step 4: Save , Exit, Compile and Run
Command to compile
after successful compilation run the executable.
Video
Create C,C++ Project on Raspberry Pin. Control LED
Reviewed by Jacky
on
October 21, 2017
Rating:

No comments: