@mfalkvidd Cool stuff, thanks!
@AWI Here you go. What a chaos... Sorry. I thought of a setup like this. But the interrupt pin of the pcf is not doing anything. Maybe I need another chip?
The resistor is 10kOhm.
NRF is also connected. And working.
The sketch is not ready, but the keyboard works on the serial line.
#include <Wire.h>
#include <Keypad_I2C.h>
#include <Keypad.h>
#define I2CADDR 0x38
#define MY_DEBUG
#define MY_RADIO_NRF24
#define MY_NODE_ID 8
#include <MySensors.h>
#include <SPI.h>
unsigned long SLEEP_TIME = 0; // Sleep time between reports (in milliseconds)
#define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define CHILD_ID 1 // Id of the sensor child
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
// Digitran keypad, bit numbers of PCF8574 i/o port
byte rowPins[ROWS] = {0, 1, 2, 3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 5, 6, 7}; //connect to the column pinouts of the keypad
Keypad_I2C kpd( makeKeymap(keys), rowPins, colPins, ROWS, COLS, I2CADDR, PCF8574 );
void setup(){
Wire.begin( );
kpd.begin( makeKeymap(keys) );
// Serial.begin(9600);
Serial.println( "start" );
pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
}
void loop(){
Serial.println("Waking up");
char key = kpd.getKey();
if (key){
Serial.println(key);
}
Serial.println("Good Night");
delay(100);
sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), FALLING, SLEEP_TIME);
}