Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Oh My Zsh #macOS
- VMware #Shared Folder
- fat32 #rufus
- Xeon #E5-2680
- Tarantula #3D 프린터
- Linux #VirtualBox
- Arduino #Wall Plotter
- ESP32 #Arduino
- centos7 #yum update #/boot
- razer #deathadder #viper #g102
- VirtualBox #VMware
- Octave #homebrew #macOS
- TensorFlow #Python #pip
- Callaway #Mavrik #Epic Flash
- VNC #Firewall #CenOS7 #VMware
- cycloidal #rv reducer
- egpu #aorus gaming box #gtx1070 #tb3
- macro lens #EF #FD
- x99 itx/ac
- Dell #Latitude #BIOS
- 다이슨 #배터리
- k6 #피코프레소
- 매크로렌즈 #리버스링
- 피코프레소 #ITOP40
- CM-EF-NEX
- XTU #Virtual Machine System
- ITOP40
- Java #MacBook #macOS
- Laptop #CPUID
- Arduino #PlatformIO #macOS
Archives
- Today
- Total
얕고 넓게
[RPi4] I2C LCD & Python 본문
0. Ref
https://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-raspberry-pi/python-usage
Adafruit 16x2 Character LCD + Keypad for Raspberry Pi
This new Adafruit Pi Plate makes it easy to use an RGB 16x2 Character LCD. We really like the RGB Character LCDs we stock in the shop. Unfortunately, these LCDs do require quite a few digital pins, 6 to control the LCD and then another 3 to control the RGB
learn.adafruit.com
1. 연결
RPi4 | I2C LCD 20x4 |
5V (2, 4) | VCC |
GND (6, 9, 14, ...) | GND |
SDA (3) | SDA |
SCL (5) | SCL |
2. 샘플 코드
import board
import busio
import adafruit_character_lcd.character_lcd_i2c as character_lcd
lcd_columns = 20
lcd_rows = 4
i2c = busio.I2C(board.SCL, board.SDA)
lcd = character_lcd.Character_LCD_I2C(i2c, lcd_columns, lcd_rows)
lcd.clear()
lcd.message = "Hello\nCircuitPython"
실행
python3 lcd.py
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 154, in __probe_for_device
self.i2c.writeto(self.device_address, b"")
File "/usr/local/lib/python3.7/dist-packages/busio.py", line 166, in writeto
return self._i2c.writeto(address, buffer, stop=stop)
File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 314, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error
3. 연결확인
pi@raspberrypi:~ $ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
4. 엘레파츠 블로그 확인
라즈베리파이에서 파이썬으로 1602 I2C 캐릭터 LCD 사용하기
이번 포스팅에서는 라즈베리파이에서 1602 IIC LCD를 이용해 문자를 출력해 보는 동작을 하도록 하겠...
blog.naver.com
5. 샘플 코드 다운로드, 실행
git clone https://github.com/eleparts/RPi_I2C_LCD_driver
cd RPi_I2C_LCD_driver
python3 example.py

'IT > Platform' 카테고리의 다른 글
[Arduino] Sensor 총정리 (0) | 2022.04.05 |
---|---|
[Arduino] 0.1 Mac 개발환경 (0) | 2022.03.30 |
[RPi] 4B Tips (0) | 2022.02.03 |
[Jetson] Power Issue @Nano (0) | 2022.02.03 |
[Beaglebone] OpenCV (0) | 2022.02.03 |