본문 바로가기

[Raspberry Pi3] 라즈베리파이3 PWM을 이용한 LED 제어 PWM이란?- Pulse Width Modulation(펄스 폭 변조)- 디지털 출력으로 아날로그 회로를 제어하는 기법 (GPIO핀은 디지털이기때문에 PWM을 이용하여 아날로그 신호를 제어한다) duty : 한 주기(T)동안 HIGH가 차지하는 비율ex) duty cycle = 50%이면 2.5V의 효과를 낼 수 있다. PWM으로 LED 점멸회로도 라즈베리파이3 GPIO Pin 구조는 http://cccding.tistory.com/89 확인 led.c#include#include#include #define LED 1 int main(){pinMode(LED , OUTPUT); //핀 초기화if(wiringPiSetup()==-1)return 1; softPwmCreate(LED,0,100); //PW.. 더보기
[Raspberry Pi3] 라즈베리파이3 wiringPi 라이브러리설치 wiringPi 라이브러리란?- 라즈베리파이에서 c언어를 이용하여 프로그래밍할때 많이 사용하는 라이브러리- c언어를 이용하여 GPIO핀을 제어할 수 있는 기능을 제공 wiringPi 설치방법- sudo apt-get update- sudo apt-get upgrade- sudo apt-get install git-core (github를 통해 다운받기 때문에 , git-core 설치)- git clone git://git.drogon.net/wiringPi (wiringPi 디렉토리가 홈디렉토리에 설치됨)- cd wiringPi (wiringPi 디렉토리로 이동)- ./build (빌드 및 설치) wiringPi 설치확인- gpio -v (버젼 확인)- gpio readall (gpio pin heade.. 더보기
[Raspberry Pi3] 라즈베리파이3 GPIO Header GPIO 구조는 다음과 같다.- Physical : PCB상의 물리적인 GPIO 핀 번호- WiringPi : wiringPi 라이브러리 GPIO 번호- BCM : python에서의 GPIO 번호(브로드컴 칩에 의해 정의된 번호체계이다) Communication Interface (physical pin 기준)- UART , BT : 8 , 10- I2C : 3 , 5- SPI : 19 , 21 , 23 , 24 , 26- ID EEPROM : 27 , 28 더보기
[Device Driver] 대소문자 변환 Device Driver 만들기 작업 환경-메인 OS : Windows 8.1K(Intel Core i5-4590)-작업 OS : Ubuntu 14.04.5 LTS 64bit(VirtualBox)-장 비 명 : Hybus-Smart4412 1. 초기설정 - mkdir device --> device 디렉토리에 examdrv.c 와 Makefile을 만든다. examdrv.c/*뼈대 작성*/#include #include #include #include #include #include #include #define DEVICE_NAME "examdrv"#define MYDRV_MAX_LENGTH4096#define MIN(a, b) (((a) < (b)) ? (a) : (b)) struct class *myclass;struct cdev.. 더보기