I2C on maker nano rp2040

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

I2C on maker nano rp2040

Postby Pjotr » Mon Nov 14, 2022 9:12 pm

Hi there,

First and foremost, I'm excited to join the cytron community.
I recently purchased a maker nano rp2040 for a grow room project.
For this project, I use several sensors and effectors, some of which use the I2C protocol.
I know the maker nano rp2040 has 2 such ports. On pins 0 and 1 (I2C 0) as well as on pins 26 and 27 (I2C 1).
I use the arduino IDE (and only this one - C language) to program the nano rp2040 and I managed to use the I2C_0 without too much trouble, but I couldn't find a solution to use the I2C_1 port.
In short, I want to connect and program on the same I2C port (sockets 26 and 27) a 16x02 LCD (address 0x27) and a co2/voc sensor (CJMCU-811 address 0x5B).
Does anyone have a solution for me.

In advance 1000xthanks.
I wish everyone a great day.

PS: This is a project with 4th secondary students aged 15/16. So the solution should be quite simple.
Pjotr
Greenhorn
 
Posts: 2
Joined: Mon Nov 14, 2022 8:43 pm

Re: I2C on maker nano rp2040

Postby waiweng83 » Fri Feb 10, 2023 10:17 am

To use I2C 1 on pin 26 and 27, you will need to reassign the pin using the following code:

CODE: SELECT_ALL_CODE
Wire1.setSDA(26);
Wire1.setSCL(27);
Wire1.begin();


Hope this helps.

Thanks.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 26 guests

cron