Languege/c++ 라이브러리 설치

GPIO 라이브러리 설치

기린정 2023. 2. 6. 15:11
https://github.com/pjueon/JetsonGPIO

Installation

1. Clone the repository.

git clone https://github.com/pjueon/JetsonGPIO

2. Make build directory and change directory to it.

cd JetsonGPIO
mkdir build && cd build

3. Configure the cmake

cmake .. [OPTIONS]

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_EXAMPLES=ON -DJETSON_GPIO_POST_INSTALL=ON

OptionDefault valueDescription

-DCMAKE_INSTALL_PREFIX= /usr/local Installation path
-DBUILD_EXAMPLES= ON Build example codes in samples
-DJETSON_GPIO_POST_INSTALL= ON Run the post-install script after installation to set user permissions. If you set this OFF, you must run your application as root to use Jetson GPIO.

4. Build and Install the library

sudo make install

5. MakeFile

 

 

6. Code

 
 
#include <JetsonGPIO.h>


void *GPIOThread(void *num){
  int iLed1_R=19, iLed1_G=21, iLed1_B=23;
  int iLed2_R=29, iLed2_G=31, iLed2_B=33;
  char acPrn[MAX_PRN_LEN];
  sprintf(acPrn, "%s;Start\n", __func__);
  LogMsg((uint8_t *)acPrn);
  GPIO::cleanup();
  sleep(2);
  GPIO::setmode(GPIO::BOARD);
  sleep(1);
  GPIO::setup(iLed1_R, GPIO::OUT, GPIO::LOW);
  GPIO::setup(iLed1_G, GPIO::OUT, GPIO::LOW);
  sleep(1);
  GPIO::output(iLed1_R, GPIO::HIGH);
  GPIO::output(iLed1_G, GPIO::HIGH);
  //GPIO::output(iLed1_R, GPIO::HIGH);

}
728x90