Notice
Recent Posts
Recent Comments
Today
Total
05-15 08:05
Archives
관리 메뉴

Jeongchul Kim

Intel Edison Board IoT Eclipse 본문

사물인터넷

Intel Edison Board IoT Eclipse

김 정출 2016. 3. 8. 11:27


Intel Edison Board IoT Eclipse


Edison IoT Eclipse

32bit 라고 뜨면서 안켜지는 오류 해결

C:\Intel\iotdk-ide-win

devkit-launcher.bat 편집


:javabitcheck

REM Check Java Bit-version

REM java -version 2>&1 | find "64-Bit" >nul:

REM IF ERRORLEVEL 1 (

REM    ECHO Detected Java 32-Bit. The Intel^(R^) IoT Developer Kit supports only Java JRE 64-Bit.

REM    ECHO %HOW_TO_INSTALL_JAVA%

REM    PAUSE

REM    GOTO end

REM )


REM으로 주석 처리

툴과 보드의 버전을 맞추기 위해 Yes를 누른다.

업데이트 중



seach Target 버튼으로 타겟을 확인한다.

OK 버튼을 눌러 선택 완료한다.


Finish 버튼을 눌러 프로젝트 생성 완료



업로드를 마추고, 컴파일을 진행한다.


컴파일을 한다.


업로드는 Run을 하면된다.





SSH 접속하여 확인하기


Ssh Shells에서 Lunch Shell 실행


Ssh Terminals에서 Lunch Terminal 실행





LED 제어 C프로그래밍 GPIO 13번


#include <stdio.h>

#include <stdlib.h>

#include <fcntl.h>

#include <unistd.h>

int main() {

/* Setup your example here, code that should run once

 */

int gpio_pin = 40;

int fd;

char buf[BUFSIZ];

fd = open("/sys/class/gpio/export",O_WRONLY);

if(fd == -1) {

perror("fail to open export");

return 1;

}

sprintf(buf,"%d",gpio_pin); // buffer use

if(write(fd,buf,sizeof(buf)) == -1) {

perror("fail to write export");

return 1;

}

sprintf(buf,"/sys/class/gpio/gpio%d/direction",gpio_pin);

fd = open(buf, O_WRONLY);

if(fd == -1) {

perror("fail to open GPIO Direction");

return 1;

}

if(write(fd,"out",4) == -1) {

perror("fail to set direction.");

return 1;

}

sprintf(buf,"/sys/class/gpio/gpio%d/value",gpio_pin);

fd = open(buf, O_WRONLY);

if(fd == -1) {

perror("fail to open GPIO Direction");

return 1;

}

while(1) {

if(write(fd,"1",sizeof("1")) == -1) {

perror("fail to set value 1");

return 1;

}

printf("set gpio %d value as HIGH\n",gpio_pin);

sleep(1);

if(write(fd,"0",sizeof("1")) == -1) {

perror("fail to set value 0");

return 1;

}

printf("set gpio %d value as LOW\n",gpio_pin);

sleep(1);

}

return 0;

}


실행이 안된다면, 핀 40번 unexport 하기

root@edison_kjc:~# echo 40 > /sys/class/gpio/unexport





Comments