hi, sorry for the hypernoob question that im going to do, but, i need some help, i conect the mcp23017 to an arduino pro micro i2c via (2 scl, 3 sda) its really necesary put the resistors into both wires? can someone helpme with a simple conecction esquematic? im really lost XD.
thanks in advice.
Take care.
Juan.
here is my squematic
But that is a Uno, not a arduino pro micro.
So first of all exactly what sort of pro micro do you have?
There are three types of board:-
- From Arduino
- From Spark Fun
- From places like eBay
They all have different pins for the I2C lines.
So please post a picture of what to have.
Yes they are called pull up resistors, and once we know what you have We can show you what to do.
You seem to show a pot connected to two pins going into the MCP23017. That chip handles digital signals only.
Hi, sorry for the late response i was bussy with my job, you are right i have a pro micro (bought from alliexpress actually) and on the image that i shared its an uno, i can explain a bit my idea of proyect, im interested on conect 8 encoders (i2c via) to my arduino pro micro made in china (sda and scl are 2 and 3 pins respectly). i saw this repository tttapa/Control-Surface: Arduino library for creating MIDI controllers and other MIDI devices. (github.com) and i think. its a good idea do that, but, when i put all together dindt work :´( here is my squematic
#include <Wire.h>
#include <Control_Surface.h>
#include <AH/Hardware/MCP23017Encoders.hpp>
// Type for the MCP23017 encoders (translates encoder pulses to position)
using WireType = decltype(Wire); // The type of I²C driver to use
using EncoderPositionType = uint8_t; // The type for saving encoder positions
using MCPEncoderType = MCP23017Encoders<WireType, EncoderPositionType>;
// Type for the MIDI encoders (translates position to MIDI messages)
struct CCMCPEncoder : GenericMIDIRotaryEncoder<MCPEncoderType::MCP23017Encoder,
RelativeCCSender> {
CCMCPEncoder(MCPEncoderType::MCP23017Encoder enc, MIDIAddress address,
int16_t multiplier = 1, uint8_t pulsesPerStep = 4)
: GenericMIDIRotaryEncoder(std::move(enc), address, multiplier,
pulsesPerStep, {}) {}
};
USBDebugMIDI_Interface midi;
// Create an object that manages the 8 encoders connected to the MCP23017.
MCPEncoderType enc {Wire, 0x0, 10};
// │ │ └─ Interrupt pin
// │ └────── Address offset
// └──────────── I²C interface
// Instantiate 8 MIDI rotary encoders.
CCMCPEncoder ccencoders[] {
{
enc[0], // The encoder to use
MCU::V_POT_1, // The MIDI address
1, // Encoder speed multiplier
4, // Number of pulses per physical "click" of the encoder
},
{enc[1], MCU::V_POT_2},
{enc[2], MCU::V_POT_3},
{enc[3], MCU::V_POT_4},
{enc[4], MCU::V_POT_5},
{enc[5], MCU::V_POT_6},
{enc[6], MCU::V_POT_7},
{enc[7], MCU::V_POT_8},
};
void setup() {
Control_Surface.begin();
Wire.begin(); // Must be called before enc.begin()
Wire.setClock(800000);
enc.begin(); // Initialize the MCP23017
}
void loop() {
enc.update();
Control_Surface.loop();
}"
Pity you did not post a photograph because personally I would not touch that source with a barge pole. You never know what sort of nonsense you will get from them. It probably be not what you think it is.
I urge you to post a photo or the link to what you actually have.
If you want the member that supports this library, lets see if we can summon him
@PieterP
He is the expert with this.
Please re-post your code, but first please review the forum guidelines and use code tags for clarity. Also, include links to technical information about your hardware. For more guidance, check out this useful link: Useful Links and Tutorials.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.