SparkFun Forums 

Where electronics enthusiasts find answers.

Tips, tricks, & best best practices using Artemis with your board designs.
User avatar
By benedic2
#216844
Hello, I am fairly new to using redboards. I have a redboard Artemis Nano. the site says there are 4 i2c buses on the board (including the QUIC connector). I was wondering if anyone knows of a guide, example, video, tutorial etc... on how to use more than one i2c bus? It seems obvious, but I have not found too much help.

BTW, the reason is I have two sensors with the same i2c address, so to use them both I would like to use the QUIC connector and a second i2c bus.

THANKS!
User avatar
By liquid.soulder
#216857
Declare a new wire port using the IOM instance that you want like this:

TwoWire myWire(N);

Choose N depending on which pins you want to use (there are 3 options that aren't on the qwiic connector) for example pins 9 and 10 on the Nano are connected to IOM# N=4
https://cdn.sparkfun.com/assets/5/5/1/6 ... s-Nano.pdf

Then you use "myWire" just like you would the normal "Wire"
User avatar
By jry
#232749
As of the latest 2.2.1 core (today 4/20/22) this takes two arguments, which are the SDA and SCL pins (not a single device number). Compiling and running the code causes a hard fault. The other method that I used in the past on a Redboard Thing was to reference an external pre-defined Wire1() object as my second i2c device. The result of that technique on Nano is also a hard fault.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum