(risolto) Problemi con MCP23017

buongiorno
come da titolo sto cercando di utilizzare un mcp23017 ma ottengo errori
uso lo sketch blink fornito con gli esempi
grazie

// Blinks an LED attached to a MCP23XXX pin.

// ok to include only the one needed
// both included here to make things simple for example
//#include <Adafruit_MCP23X08.h>
#include <Adafruit_MCP23X17.h>

#define LED_PIN 0     // MCP23XXX pin LED is attached to

// only used for SPI
#define CS_PIN 6

// uncomment appropriate line
//Adafruit_MCP23X08 mcp;
Adafruit_MCP23X17 mcp;

void setup() {
  Serial.begin(9600);
  //while (!Serial);
  Serial.println("MCP23xxx Blink Test!");

  // uncomment appropriate mcp.begin
  if (!mcp.begin_I2C()) {
  //if (!mcp.begin_SPI(CS_PIN)) {
    Serial.println("Error.");
    while (1);
  }

  // configure pin for output
  mcp.pinMode(LED_PIN, OUTPUT);

  Serial.println("Looping...");
}

void loop() {
  mcp.digitalWrite(LED_PIN, HIGH);
  delay(500);
  mcp.digitalWrite(LED_PIN, LOW);
  delay(500);
}
Arduino: 1.8.15 (Windows 10), Board: "Arduino Nano, ATmega328P"
In file included from C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp:23:0:

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::pinMode(uint8_t, uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23X17.h:8:0,

                 from C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23X17.cpp:5:

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23X17.cpp: In member function 'uint16_t Adafruit_MCP23X17::readGPIOAB()':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'uint8_t Adafruit_MCP23XXX::digitalRead(uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23X17.cpp: In member function 'void Adafruit_MCP23X17::writeGPIOAB(uint16_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::digitalWrite(uint8_t, uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'uint8_t Adafruit_MCP23XXX::readGPIO(uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::writeGPIO(uint8_t, uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::setupInterrupts(bool, bool, uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::setupInterruptPin(uint8_t, uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'void Adafruit_MCP23XXX::disableInterruptPin(uint8_t)':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.cpp: In member function 'uint8_t Adafruit_MCP23XXX::getLastInterruptPin()':

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: error: 'ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE' was not declared in this scope

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^

C:\Users\stefano\Documents\Arduino\libraries\Adafruit_MCP23017_Arduino_Library\src\Adafruit_MCP23XXX.h:29:3: note: in definition of macro 'MCP23XXX_SPIREG'

   ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

exit status 1

Error compiling for board Arduino Nano.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Come hai installato IDE e come hai installato la libreria ?
Per l'IDE non usare lo store di windows, usa lo zip che poi spacchetti in una cartella nota, esempio c:\Arduino
Per la libreria installala dal gestore librerie (sconsiglio di scaricare lo zip e poi installare da quello) se possibile

grazie per il riscontro

Per l'IDE non usare lo store di windows, usa lo zip che poi spacchetti in una cartella nota, esempio c:\Arduino

si fatto da zip

Per la libreria installala dal gestore librerie (sconsiglio di scaricare lo zip e poi installare da quello) se possibile

fatto dal manager

ho provato a leggere le lib ma senza successo
mi puoi descrivere cosa significa l'errore

grazie

Nelle imposyazioni metti il flag alla voce verbose x errori di compilazione (non ricordo la frase precisa on italiano) e poi compila, per avete più info.

Sembrerebbe che per qualche ragione il tuo IDE non gestisca correttamente il salto a capo ' \ ' nella linea 28 di Adafruit_MCP23XXX.h

Prova a mettere tutto su una riga e dovrebbe andare (anche riga 17 stessa cosa).
Però la cosa non è normale e dovrebbe compilare anche con il carattere ' \ ' ... dovresti rivedere l'installazione dell'IDE. Magari cancella tutto e riparti da un sistema pulito.

#define MCP23XXX_SPIREG                                                        \
  ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type
#define MCP23XXX_SPIREG  ADDRESSED_OPCODE_BIT0_LOW_TO_WRITE //!< SPI register type

grazie per il supporto
stasera provo di nuovo
uso ide da zip come suggerito da NID69 e dopo aver pulito tutto come suggerisce COTESTATNT

ste

Ti suggerisco anche di creare una versione "portable", ovvero:

  1. spacchetta lo zip in cartella nota, esempio c:\Arduino
  2. crea una sottocartella "portable" c:\Arduino\portable
  3. solo dopo aver creato la cartella del punto 2 avvia l'ide
    Ora sketch e librerie saranno assieme all'IDE dentro a c:\Arduino invece che in cartelle separate.

grazie
questo mi interessa anche per avere arduino al lavoro
per il mcp23017 ho risolto, si trattava di aggiornare una libreria adafruit la BUSio adesso compila senza errori gli esempi forniti

grazie ancora