#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED width, in pixels
#define SCREEN_HEIGHT 64 // OLED height, in pixels
// create an OLED display object connected to I2C
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
#include <Keypad.h>
const byte ROWS = 3;
const byte COLS = 3;
char keys[ROWS][COLS] = {
{'A','B','C'},
{'<', '^','D'},
{'_','X','>'}
};
byte rowPins[ROWS] = {6, 5, 4}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 15, 16}; //connect to the column pinouts of the keypad
//Create an object of keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup() {
Serial.begin(9600);
// initialize OLED display with I2C address 0x3C
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("failed to start SSD1306 OLED"));
while (1);
}
delay(2000); // wait two seconds for initializing
oled.clearDisplay(); // clear display
oled.setTextSize(2); // set text size
oled.setTextColor(WHITE); // set text color
oled.setCursor(5, 25); // set position to display (x,y)
oled.println("Heart Beat"); // set text
oled.display(); // display on OLED
}
void loop(){
char key = keypad.getKey();// Read the key
// Print if key pressed
if (key){
Serial.print("Key Pressed : ");
Serial.println(key);
oled.clearDisplay(); // clear display
oled.setTextSize(3); // set text size
oled.setTextColor(WHITE); // set text color
oled.setCursor(50, 20); // set position to display (x,y)
oled.println(key); // set text
oled.display();
}
}
esp:0
esp:1
esp:2
esp:3
esp:4
esp:5
esp:6
esp:7
esp:8
esp:9
esp:10
esp:11
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:20
esp:21
esp:35
esp:36
esp:37
esp:38
esp:39
esp:40
esp:41
esp:42
esp:45
esp:46
esp:47
esp:48
esp:3V3.1
esp:3V3.2
esp:RST
esp:5V
esp:GND.1
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:GND.4
oled1:GND
oled1:VCC
oled1:SCL
oled1:SDA
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r
btn4:1.l
btn4:2.l
btn4:1.r
btn4:2.r
btn5:1.l
btn5:2.l
btn5:1.r
btn5:2.r
btn6:1.l
btn6:2.l
btn6:1.r
btn6:2.r
btn7:1.l
btn7:2.l
btn7:1.r
btn7:2.r
btn8:1.l
btn8:2.l
btn8:1.r
btn8:2.r
btn9:1.l
btn9:2.l
btn9:1.r
btn9:2.r
oled2:GND
oled2:VCC
oled2:SCL
oled2:SDA