반응형
해결 GPIO.setmode(GPIO.BOARD) AttributeError: 'module' object has no attribute 'setmode'
raspberry pi에서 RFID-RC522를 이용한 카드인식 시스템을 만들고 있었는데요
setmode에러가나서 한참을 고생하다 구글링을 통해 해결했습니다
구글 검색어
GPIO.setmode(GPIO.BOARD) AttributeError: 'module' object has no attribute 'setmode'
참고한 내용
출력된 에러
$sudo python Dump.py Traceback (most recent call last): File "Dump.py", line 21, in <module> MIFAREReader = MFRC522.MFRC522() File "/home/imcloud/download/MFRC522-python/MFRC522.py", line 112, in __init__ GPIO.setmode(GPIO.BOARD) AttributeError: 'module' object has no attribute 'setmode' |
해결 방법
sudo easy_install -U RPi.GPIO 이 명령어를 실행해서 RPI.GPIO를 설치합니다
Searching for RPi.GPIO Reading http://pypi.python.org/simple/RPi.GPIO/ Best match: RPi.GPIO 0.5.11 Downloading https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz#md5=9dc3dab6ce2b7ccb833a866efb392821 Processing RPi.GPIO-0.5.11.tar.gz Running RPi.GPIO-0.5.11/setup.py -q bdist_egg --dist-dir /tmp/easy_install-IOIu1H/RPi.GPIO-0.5.11/egg-dist-tmp-yky5fe zip_safe flag not set; analyzing archive contents... Removing RPi.GPIO 0.1.0 from easy-install.pth file Adding RPi.GPIO 0.5.11 to easy-install.pth file Installed /usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.5.11-py2.7-linux-armv6l.egg Processing dependencies for RPi.GPIO Finished processing dependencies for RPi.GPIO |
에러를 해결후 잘 동작함
Welcome to the MFRC522 data read example Press Ctrl-C to stop. Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Card detected Card read UID: 23,101,85,197 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ^CCtrl+C captured, ending read.
|
반응형
'보물창고 > Programming' 카테고리의 다른 글
Centos sudo 권한 설정 방법 (0) | 2017.04.05 |
---|---|
Java FFTW FFT maginute frequency example real imaginary 예제 정리 (1) | 2015.11.17 |
정규식 공백 두개 하나로 바꾸기 치환 변경 수정 (1) | 2015.08.17 |
elasticsearch index client java api example mavne 프로젝트 기본 구조 (0) | 2015.07.20 |
FFT DFT java example 이론 정리와 java 예제 코드 구성 (4) | 2015.07.15 |
라즈베리파이 아두이노 무선 통신 rf315/433 사용하기 arduino raspberry pi (2) | 2015.04.29 |
라즈베리파이와 아두이노 RF315/433 송수신 코드 정리 raspberry arduino (0) | 2015.04.24 |
aliexpress 아두이노 라즈베리파이 무선 통신 부품 구입 릴레이 RF315/433 (0) | 2015.04.13 |