Mercurial > d1workshop
changeset 52:65374c79d8ff
FIx i2c in oled shields
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Mon, 10 Jul 2017 14:42:27 +0200 |
| parents | 9b344c729142 |
| children | ffd7871811f2 f749ec2ab894 |
| files | shields.rst |
| diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/shields.rst Fri Jul 07 19:38:07 2017 +0200 +++ b/shields.rst Mon Jul 10 14:42:27 2017 +0200 @@ -96,7 +96,7 @@ import ssd1306 from machine import I2C, Pin - i2c = I2C(Pin(5), Pin(4)) + i2c = I2C(-1, Pin(5), Pin(4)) display = ssd1306.SSD1306_I2C(64, 48, i2c) display.fill(0) display.text("Hello world!") @@ -120,7 +120,7 @@ import d1motor from machine import I2C, Pin - i2c = I2C(Pin(5), Pin(4), freq=10000) + i2c = I2C(-1, Pin(5), Pin(4), freq=10000) m0 = d1motor.Motor(0, i2c) m1 = d1motor.Motor(1, i2c) m0.speed(5000) @@ -175,7 +175,7 @@ from servo import Servos from machine import I2C, Pin - i2c = I2C(Pin(5), Pin(4)) + i2c = I2C(-1, Pin(5), Pin(4)) servos = Servos(i2c) servos.position(0, degrees=45) @@ -190,12 +190,11 @@ from machine import Pin, SPI import st7735 - from rgb import DummyPin - display = st7735.ST7735(SPI(1), dc=Pin(12), cs=DummyPin(), rst=Pin(15)) + display = st7735.ST7735(SPI(1), dc=Pin(12), cs=None, rst=Pin(15)) display.fill(0x7521) display.pixel(64, 64, 0) If you have a display with a red tab, you need to use a different initialization:: - display = st7735.ST7735R(SPI(1, baudrate=40000000), dc=Pin(12), cs=DommyPin(), rst=Pin(15)) + display = st7735.ST7735R(SPI(1, baudrate=40000000), dc=Pin(12), cs=None, rst=Pin(15))
