Go Down

Topic: Foilkeypad (keypad.h 3.1.1) compile error on Zero (Read 515 times) previous topic - next topic


Jul 01, 2020, 09:19 am Last Edit: Jul 01, 2020, 09:25 am by Meins321 Reason: Attachment missing
Hello everyone,

My hardware:
M0+4x4Foilkeyboar+I2C (PCF8574 on I2C) and then add the TFT ST773 on SPI.

The moment i include this library for my ST7735 the compilation fails :-(

Can any one help me to change the "IDLE redeclaration" for both librarys to work together on my M0?

Code: [Select]

 file included from K:\arduino-1.8.13\portable\sketchbook\libraries\Keypad\src/Keypad.h:36:0,
                 from K:\arduino-1.8.13\portable\sketchbook\libraries\Keypad_I2C/Keypad_I2C.h:43,
                 from K:\arduino-1.8.13\portable\sketchbook\Keypad_i2c\Keypad_i2c.ino:29:
K:\arduino-1.8.13\portable\sketchbook\libraries\Keypad\src/Key.h:41:15: error: redeclaration of 'IDLE'
 typedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState;
In file included from K:\arduino-1.8.13\portable\sketchbook\Keypad_i2c\Keypad_i2c.ino:28:0:
K:\arduino-1.8.13\portable\sketchbook\libraries\TFT_ST7735-1.0p1/TFT_ST7735.h:104:38: note: previous declaration 'ST7735_modes IDLE'
 enum ST7735_modes { NORMAL=0,PARTIAL,IDLE,SLEEP,INVERT,DISP_ON,DISP_OFF };//0,1,2,3,4,5,6
exit status 1
Fehler beim Kompilieren für das Board Arduino Zero (Native USB Port).

Code: [Select]

Complete Sketch:
#include <Keypad_I2C.h>
#include <Keypad.h>        
#include <Wire.h>

//Would like to use ST7735 displays and gives error:
#include <SPI.h>  // include for TFT
#include <TFT_ST7735.h> // https://github.com/sumotoy/TFT_ST7735/tree/1.0p1

/****************************(Definieren der Globale Variablen)***************************/
#define I2CADDR 0x20                          // I2C Adresse vom PCF8574

const byte anzZeilen = 4;                        //Anzahl Zeilen
const byte anzSpalten = 4;                       //Anzahl Spalten

//Symbole Keypad
char tastenLayout[anzZeilen][anzSpalten] = {

//Hier definieren wie das Keypad mit den IO Pins vom PCF8574 verdrahtet ist.
byte zeilenPins[anzZeilen]   = { 0, 1, 2, 3};     //Zeilen Pins
byte spaltenPins[anzSpalten] = { 4, 5, 6, 7};     //Spalten Pins

//Initialisierung von Keypad
Keypad_I2C i2cKeypad( makeKeymap(tastenLayout), zeilenPins, spaltenPins, anzZeilen, anzSpalten, I2CADDR);

void setup(){
  Wire.begin( );
  i2cKeypad.begin( );        

void loop(){
  char ausgeleseneTaste = i2cKeypad.getKey();
if (ausgeleseneTaste != NO_KEY){



Jul 01, 2020, 09:26 am Last Edit: Jul 01, 2020, 11:01 am by Meins321
From the keypad I2C Library i only use the upper Keypad_I2C for the pcf8574

Okay i changed in the Keypad.cpp the IDLE to IDLE_KEY now it collides less with this library..

Go Up