Embedded/Kernel Porting

[Kernel Porting-8] H-Smart4412 LCD 작동하기

tunanut 2016. 12. 26. 19:14
반응형

작업 환경

-메인 OS : Windows 8.1K(Intel Core i5-4590)

-작업 OS : Ubuntu 14.04 64bit(VirtualBox)

-장 비 명 : H-Smart4412


1. lcd.c - scanf로 입력 받아 lcd에 띄우기

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>

#define clcd "/dev/clcd"
int main()
{
    int clcd_d;
    char buf[10];

    if((clcd_d = open(clcd,O_RDWR)) < 0)
    {
        perror("open");
        exit(1);
    }

    scanf("%s",buf);
    write(clcd_d,&buf,strlen(buf));
    close(clcd_d);
    return 0;
}


반응형