Top Ad unit 728 × 90


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.
sudo apt-get 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
Step 3: Build and install wiring pi library
Once downloaded, go to directory
cd wiringPi
Then run below command.
./build



Step 4: Write your code. 
Open your text editor, Nano in my case, copy following code to your editor.

#include <stdio.h>
#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: 5

No comments:

All Rights Reserved by JackyLe © 2018 © 2017
Edit bởi: Jacky Le | Youtube Channel: JACKY LE

Send email form

Name

Email *

Message *

Powered by Blogger.