<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Working with I2C and port expander]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I have not been working with I2C that much before, and I have a port expander (<a href="https://www.nxp.com/docs/en/data-sheet/PCAL6416A.pdf" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.nxp.com/docs/en/data-sheet/PCAL6416A.pdf</a>), which wants me to write data in bits. I am trying to write 8 bits to the "Configuration register pair", address hex 06 and hex 07, like this:</p>
<pre><code>self.i2c.writeto_mem(self.write_address, 0x6, 0b00000000) #Write 0 to all 8 pins on the first port to turn them into outputs
self.i2c.writeto_mem(self.write_address, 0x7, 0b00000000) #Write 0 to all 8 pins on the second port to turn them into outputs
</code></pre>
<p dir="auto">But I get an I2C bus error, which I assume is because I am not writing the bits correctly. Any ideas?</p>
]]></description><link>https://forum.pycom.io/topic/6589/working-with-i2c-and-port-expander</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 11:05:17 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/6589.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Nov 2020 19:07:10 GMT</pubDate><ttl>60</ttl></channel></rss>