Januar Chayadi
Member
Hi There.. I'm new AT B4R.. Now i'm trying to work with i2c project with PCF 8574.. I already success with scanning the ID of PCF.. But i can't figure it out how to using a pin PCF 8574 AS I/O. Please Help Thx.
THX mister cableguy.. i think i get it now... Now i will continued my main project.. and if it finish i will share in this forumm... thx again...I am inclined to think is just an "leftover" from the original code as 0x71 is a very common I2C address.
You are the best brooo....
hi there.. i want to ask a question.. how can i send the data in bit not in bytes using WireMaster.Writeto .. Is that Posible.. or there is other way?If you are lost, I presume that you can use my 8575 code on an 8574 and just change the address and only read the first 8 bits, it's a lot easier to understand and follow. I don't own any 8574's but I would presume that reading and writing to them is basically the same the 8575, but I could be incorrect.
Pi based boards use non-ui b4j programshello do you know how use i/o PCF8574 at NANOPI? :0 help me
Pi based boards use non-ui b4j programs
Sub Process_Globals
Public ic As WireMaster
End sub
Private Sub AppStart
ic.Initialize
End sub
Private Sub ic_Read(pin As UInt) As Boolean
Dim pinstatus As Int
ic.WriteTo(0x24, Array As Byte(0x00))
Dim result() As Byte = ic.RequestFrom(0x24, 1)
If result.Length = 0 Then
Return False
Else
pinstatus= Bit.Get(result(0),pin)
Log(pinstatus)
If pinstatus=0 Then
Return False
Else
Return True
End If
End If
End Sub
Private Sub ic_Write(pin As UInt,pinstate As Boolean)
'ic.WriteTo(0x24, Array As Byte(0x00))
Dim result() As Byte = ic.RequestFrom(0x24, 1)
If pinstate =True Then
Bit.Clear(result(0),pin)
ic.WriteTo(0x24, Array As Byte(0x00,result(0)))
Else
Bit.Set(result(0),pin)
ic.WriteTo(0x24, Array As Byte(0x00,result(0)))
End If
End Sub