#include <FastLED.h>
#include <Keypad.h>
//fixed global variables
#define DATA_PIN 7 //Define led data pin in
#define LED_TYPE NEOPIXEL //define type of led
#define NUM_LEDS 16 //num of leds in strip
CRGBArray<NUM_LEDS> leds; //Define CRGBSET to be entire string, and call it leds
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
// will change the char later
char hexaKeys[ROWS][COLS] = {
{'A', 'B', 'C', 'D'},
{'E', 'F', 'G', 'H'},
{'I', 'J', 'K', 'L'},
{'M', 'N', 'O', 'P'}
};
byte rowPins[ROWS] = {A0,A1,A2,A3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A4,A5,2,3}; //connect to the column pinouts of the keypad
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
delay(2000); //for safe startup
FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
int key = customKeypad.getKey() - 65;
leds[key].setRGB(0, 0, 255);
FastLED.show();
}