Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wont drive P10 to P17; #1

Closed
weirros opened this issue Nov 27, 2020 · 2 comments
Closed

Wont drive P10 to P17; #1

weirros opened this issue Nov 27, 2020 · 2 comments

Comments

@weirros
Copy link

weirros commented Nov 27, 2020

Wont drive P10 to P17;
can only read P00 to p07

import pcf8575
from machine import I2C, Pin

i2c = I2C(scl=Pin(13), sda=Pin(12))

pcf = pcf8575.PCF8575(i2c)

print(0,pcf.pin(0))
print(1,pcf.pin(1))
print(2,pcf.pin(2))
print(3,pcf.pin(3))
print(4,pcf.pin(4))
print(5,pcf.pin(5))
print(6,pcf.pin(6))
print(7,pcf.pin(7))
print(10,pcf.pin(10))
print(11,pcf.pin(11))
print(12,pcf.pin(12))
print(13,pcf.pin(13))
print(14,pcf.pin(14))
print(15,pcf.pin(15))
print(16,pcf.pin(16))
print(17,pcf.pin(17))

k1=pcf.port

On a D1 mini Pro;

@weirros
Copy link
Author

weirros commented Nov 27, 2020

import pcf8575
from machine import I2C, Pin

i2c = I2C(scl=Pin(13), sda=Pin(12))
pcf = pcf8575.PCF8575(i2c)

def read8575():
  k1=pcf.port
  k2= str(bin(k1))
  k3 = []
  for i in range(len(k2[2:])):
    i=i+1
    #print(i,k2[-i])
    k3.append(int(k2[-i]))
  
  for j in range(16-len(k2[2:])):
    k3.append(0)
  
  return k3
  
f1=read8575()
print (f1)

for reading all pins

exec(open('8575.py').read(),globals())
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

@mcauser
Copy link
Owner

mcauser commented Dec 21, 2020

Are you using a pcf8575 breakout, or the chip directly?
Are you sure you have a pcf8575 and not a pcf8574?
Do you have pull ups on your I2C line?

@mcauser mcauser closed this as completed Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants